3
Answers

Unauthorized error in KeywordQuery search object SP2013

Photo of sumit kumar

sumit kumar

9y
402
1
I am getting UnauthorizedAccessException while creating KeywordQuery object. I have tried with all the overloaded method for KeywordQuery in SharePoint 2013.  I am able to create SPSite object.
 
Below is the code:
 
using (SPSite site = new SPSite(url))
{
SearchServiceApplicationProxy proxy = (SearchServiceApplicationProxy)SearchServiceApplicationProxy.GetProxy(SPServiceContext.GetContext(site));
using (KeywordQuery keywordQuery = new KeywordQuery(site))//Unauthorised Access Exception on this line
{
//doing something with KeywordQuery object
}
 

Answers (3)

0
Photo of Vulpes
NA 98.3k 1.5m 10y
Although it's not specific to MVC 4, there's a two part article here which explains the issues involved in detail:

http://afana.me/post/aspnet-mvc-internationalization.aspx

http://afana.me/post/aspnet-mvc-internationalization-part-2.aspx

However, I also found an internationalization package available from Nuget which is for MVC 4 and might save you a lot of time:

http://code52.org/aspnet-internationalization/tutorial.html






Accepted
0
Photo of Ramsès Zogning II
NA 84 12.9k 10y
0
Photo of Ramsès Zogning II
NA 84 12.9k 10y
Thk u Sir


This link http://afana.me/post/aspnet-mvc-internationalization-part-2.aspx gave me the solution.

It is true that it is for MVC 5, but I have adapted to that of MVC 4

Thk very much