function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Chris WilliamsChris Williams 

Chatter File Sharing Type via API

Is there any way to set sharing type of a Chatter File to "public/Anyone with link" programmatically?  I can specifically share to a user via their id, but I haven't seen anyway to make it public without going to salesforce.com and manually changing file settings for each file.  I'm using the following Chatter Rest API endpoint to create the chatter file but any API will work.  

instance_url + "/services/data/v25.0/chatter/feeds/news/me/feed-items";

Thanks in advance.
Best Answer chosen by Chris Williams
Jason Curtis NBSFDGJason Curtis NBSFDG
This previous post has some good solutions for you as well: https://developer.salesforce.com/forums/ForumsMain?id=906F00000009A1KIAU

All Answers

Jason Curtis NBSFDGJason Curtis NBSFDG
Are you trying to programatically get a URL for a file to share outside of an org?
Jason Curtis NBSFDGJason Curtis NBSFDG
This previous post has some good solutions for you as well: https://developer.salesforce.com/forums/ForumsMain?id=906F00000009A1KIAU
This was selected as the best answer
Chris WilliamsChris Williams
Thanks Jason, that is definitely a workable solution.  In order to get public links available for outside users I'll have to provide access it via a site (as far as I know).  While thats feasible I was hoping to find a way to create a Chatter file with a SharingType of "Anyone with link" by default.  As far as I can tell the solution you provided is the only way.  If anyone finds another way I'm all ears.  Thanks again Jason.