Microsoft.Office.Server.Audience
Here's some code to retrieve an Audience object by its name. Notice that in MOSS 2007 that the SPAudience object is obsolete so you must use the new object Microsoft.Office.Server.Audience
try
{
using (Identity impersonate = Identity.ImpersonateAdmin())
{
ServerContext context = ServerContext.GetConte(spSite);
audienceManager = new Microsoft.Office.Server.Audience.AudienceManager
(context);
}
foreach (Microsoft.Office.Server.Audience.Audience spAudience in audienceManager.Audiences)
{
if (spAudience.AudienceName = audienceName)
{
returnAudience = spAudience;
}
}
}

0 Comments:
Post a Comment
Links to this post:
Create a Link
<< Home