Tuesday, March 25, 2008

Access Denied on AudienceGlobal.CanAccess()

So I'm using the AudienceManager's GetAudience() and it blows access denied error, even when using RunWithElevatedPrivileges. I spent time looking for the root of the problem and as far as I can get is "AudienceGlobal.CanAccess(this.m_serverContext);"
which is the first line of code in the GetAudience method.

This is all withen: Microsoft.Office.Server.Audience.AudienceManager.GetAudience

I found one other reference on the web linked here: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2978930&SiteID=1

The solution provided is a work-around and I was able to use it.

foreach (Microsoft.Office.Server.Audience.Audience objAudience in audienceManager.Audiences)
{
if (objAudience != null && objAudience.AudienceName == audienceName)
{
//use objAudience just as if you had called GetAudience
}
}

1 comment:

Angry Asian said...

Hello --
i came across your blog while doing a searching for SharePoint gurus. i'm a recruiter for a software development company and we're seeing a senior consultant in Charlotte. i'd love to network with you or if you're interested in hearing about the position, you can reach me at pham@rdacorp.com.

thanks!

(sorry, i am using my personal blogspot username)