I am trying to get search categories from the code (Microsoft.Office.Server.Sear开发者_如何学编程ch.Administration.SearchServiceApplication.Schema.AllCategories). However it throws me UnAuthorized exception( ThrowIfNotSearchAdmin) error.
Has anybody faced and resolved this? Where to configure search administrator in SharePoint 2010?
Thanks
Have you tried to call the code within SPSecurity.RunWithElevatedPrivileges()?
You should go to
CA > Manage Service Application > Click on Search Service Application line to get it selected.
In a ribbon click Administrators and add the user which is going to be used to create search categories (if you use SPSecurity.RunWithElevatedPrivileges then it should be your Application Pool Account)!
精彩评论