I have a webpart in the master page which uses a jscript file to perform microblogging operations. This webpart has similar features like OOB NewsFeed part. There is no problem if I create a post which includes Mention, Url SocialData items, but if the message contains a Hashtag, the following exception is occured.

Microsoft.Office.Server.Social.SPSocialFeedManager.CreatePost: Microsoft.Office.Server.Microfeed.MicrofeedException: InsufficientPermissions : ( Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) ) The current user is not authorized to perform the operation.

I tried the code example which is found in MSDN and got same exception.

// Ensure that the SP.UserProfiles.js file is loaded before the custom code runs.
SP.SOD.executeOrDelayUntilScriptLoaded(PublishPost, 'SP.UserProfiles.js');

// Declare global variables.
var clientContext;
var feedManager;
var resultThread;

function PublishPost() {

    // Initialize the current client context and the SocialFeedManager instance.
    clientContext = SP.ClientContext.get_current();
    feedManager = new SP.Social.SocialFeedManager(clientContext);

    var socialDataItem = new SP.Social.SocialDataItem();
    var socialDataItems = [ socialDataItem ];

    // Create the post content.
    var postCreationData = new SP.Social.SocialPostCreationData();
    postCreationData.set_contentText('The text for the post, which contains a {0}.');

    // Publish the post. Pass null for the "targetId" parameter because this is a root post.
    feedManager.createPost(null, postCreationData);
    clientContext.executeQueryAsync(PostSucceeded, PostFailed);

function PostSucceeded(sender, args) {
    $get("spanMessage").innerText = 'The post and reply were published.';
function PostFailed(sender, args) {
    $get("spanMessage").innerText = 'Request failed: ' + args.get_message();

It works if I use this code in "MySite" collection.

What should I configure to send messages including hashtags in other site collections?

1 Answer 1


and the answer to your question ;)

To create an application page that uses the JavaScript object model to work with social feeds, you'll need:

•SharePoint Server 2013 with My Site configured as public, with personal sites created for the current user and a target user, with the current user following the target user, and with a few posts written by the target user

•Visual Studio 2012 or Visual Studio 2013 with Office Developer Tools for Visual Studio 2012

Full Control access permissions to the User Profile service application and permissions to deploy a farm solution for the logged-on user

Sufficient permissions for the application pool account to access the content database of the My Sites web application


give access to the account:

#Grab a reference to the User Profile Service Application
$serviceapp = Get-SPServiceApplication | where {$_.DisplayName -eq "User Profile Service Application"}

#Return the SPObjectSecurity object for the Service Application
$security = Get-SPServiceApplication $serviceapp | Get-SPServiceApplicationSecurity

#Setup our claim provider
$claimprovider = (Get-SPClaimProvider System).ClaimProvider

#Specify the required principal
$principal = New-SPClaimsPrincipal "Domain\UPSAppAccount" -IdentityType WindowsSamAccountName

#Grant the required permissions on the Service Application
Grant-SPObjectSecurity -Identity $security -Principal $principal -Rights "Full Control"
Set-SPServiceApplicationSecurity $serviceapp -ObjectSecurity $security


enter image description here

dont know if this will work but you could add your application pool account to the list and give full control!


  • 1
    Thanks for your detailed answer. All AppPool accounts have already "Full Control" Permission on User Profile Service Application, but still this exception appears. As I have written, I have only problem with #hashtags. What I've seen in following link in MSDN: msdn.microsoft.com/en-us/library/jj822975(v=office.15).aspx Reply, like, and mention references are stored indefinitely in the user’s personal feed. Tag references are stored in the Distributed Cache, so they are stored temporarily. Tags are something special..
    – Tolga
    Apr 11, 2014 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.