Question

we are using a SharePoint out of box feature to comment on the page. Comments are getting displayed if end user posts the comments however it is not getting displayed(for end users) if the comments are posted by a farm account.

Is that an expected behavior? How to solve this?

Était-ce utile?

La solution

Privacy and security implications of social tagging (SharePoint Server 2010) can help you some understanding as to how the security trimming worked on Notes web part. Following is taken from it:

Security trimming

Adding a tag, a note, or a rating to a Web page creates an activity. Before SharePoint Server displays an activity, it uses a component called the security trimmer to determine whether the current user has permission to view the Web page that the activity applies to. If the user is not permitted to view the Web page, SharePoint Server does not display the activity.

As the search service crawls Web pages, it records the permissions that are required to view each Web page. The security trimmer uses this information to determine whether a given user has permission to view a specific Web page. If the security trimmer has insufficient information to determine whether a user has permission to view a Web page, it errs on the side of caution and reports that the user does not have permission to view the Web page. As a result, if the search service has not crawled a Web page, activities that relate to that Web page will not be displayed.

Autres conseils

This man suggests some valid work-arounds to this issue.
I had the same challenge with a project for my company and used some of his work-arounds to solve the issue.

Take a look at this blog were they resolve this by code:

var type = typeof(SocialCommentManager);
var methods = type.GetMethods(System.Reflection.BindingFlags.DeclaredOnly | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
var method = methods.FirstOrDefault(m => m.ToString() == "Microsoft.Office.Server.SocialData.SocialComment[] GetComments(System.Uri, Int32, Int32, System.DateTime, Boolean)");
if (method == null) throw new MissingMethodException("Social GetComment method not found.");
var comments = method.Invoke(cm, new object[] { uri, 10000, 0, DateTime.MinValue, false }) as SocialComment[];

I had a similar issue where I wanted to get a number of comments in code. Comments are security-trimmed. Try to set the app pool account as Social Data Administrator: Central Administration -> Application Management -> Service Applications -> User Profile Services.

Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top