2

I am trying to inserting Feed-Item with Attachment.

I know that I have to the put Image File into Content and get the Content-Version Id. I can use the Content Version Id to reference in RelatedToID and this inserts a record with attachment in Community.

When i tried to feeditem with attachment by my userID (insertedbyId), its working. (As all files are mass uploaded by me and i am owner of all 100 files).

But for such records where insertedbyId is other user, its failing. Giving below error.

You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary.

The problem seems to be as you state: the user trying to create the feed item doesn't have access to the file.

But how to give user access to 500 files which i had uploaded ?

1
  • Just taking a stab, how are you inserting the files through API or the UI. Can you create a chatter group and post the file
    – Rao
    Commented Sep 11, 2015 at 17:19

1 Answer 1

1

You, as the initial user to upload the file will be the owner of the file. There are a couple methods you can use to give another user access:

1 - Insert a ContentDocumentLink between the file and the user you want to share with.

2 - Create a feed item on the other user's wall with the file, which ends up creating a ContentDocumentLink as well.

If you do not want to have 500 posts on the other user's wall, then option 1 should be used.

Inserting into ContentDocumentLink, you can specify individual user ids as the LinkedEntityId, however, if you want to share with many users, it is suggested you use a different entity. You can create a ContentDocumentLink sharing a file with a record (like an Account), a Chatter group, or even to the organization Id, which grants access to everyone in the org.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .