6

I have a two views of my List and two SharePoint groups. Only one List view is visible depending on the user logged in according to his group.

I am using SitePage and added a WebPartZone to it. In the Feature Activated method I used SPLimitedWepartManager and added two XSLTListViewWebPart and added the views accordingly. Also set target Audience for each XSLTListViewWebPart. and added the XSLTListViewWebParts to the SPLimitedWepartManager.

When I deploy the solution I get an error:

Error occurred in deployment step 'Activate Features': UserProfileApplicationNotAvailableException_Logging :: UserProfileApplicationProxy.ApplicationProperties ProfilePropertyCache does not have 64961d83-fdf2-4d48-8137-8860f07e64b8

I have added the code below:

public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
        SPSite site = null;
        site = properties.Feature.Parent as SPSite;

        string strG = "Global Users";
        string strR = "Regional Users";

        SPGroup Ggroup = null;
        SPGroup Rgroup = null;
        SPList list = null;

        using (SPWeb web = site.OpenWeb())
        {
            web.AllowUnsafeUpdates = true;

            Ggroup = web.Groups[strG];
            Rgroup = web.Groups[strR];

            using (SPLimitedWebPartManager wpManager = web.GetLimitedWebPartManager(web.Url + "/SitePages/CustomSitePages/RequestSitePage.aspx", System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared))
            {

                //For Regional Users
                XsltListViewWebPart xlvWebpart_Regional = new XsltListViewWebPart();
                list = web.Lists.TryGetList("RequestList");

                SPView listView_R = null;
                SPListItem listItem_R = null;
                listItem_R = list.Items.Add();
                SPServiceContext context = SPServiceContext.GetContext(site);

                listView_R = list.Views["RegionalUsers"];
                xlvWebpart.ListId = list.ID;
                xlvWebpart_Regional.ViewGuid = listView_R.ID.ToString();
                xlvWebpart_Regional.Title = "Regional Users";
                AudienceManager audienceManager_R = new AudienceManager(context);
                // ERROR in the below Line of Code. Project gets deployed when the below line is commented
                xlvWebpart_Regional.AuthorizationFilter = string.Format("{0};;;;", audienceManager_R.GetAudience(strR).AudienceID); // ERROR in this Line of Code

                wpManager.AddWebPart(xlvWebpart_Regional, "UsersZone", 0);
                wpManager.SaveChanges(xlvWebpart_Regional);

                //For Global Users
                XsltListViewWebPart xlvWebpart_Global = new XsltListViewWebPart();
                SPView listView_G = null;
                SPListItem listItem_G = null;
                listItem_G = list.Items.Add();


                listView_G = list.Views["GlobalUsers"];
                xlvWebpart_Global.ListId = list.ID;
                xlvWebpart_Global.ViewGuid = listView_G.ID.ToString();
                xlvWebpart_Global.Title = "Global Users";
                AudienceManager audienceManager_G = new AudienceManager(context);
                // ERROR in the below Line of Code. Project gets deployed when the below line is commented
                xlvWebpart_Global.AuthorizationFilter = string.Format("{0};;;;", audienceManager_G.GetAudience(strG).AudienceID); // ERROR in this Line of Code

                wpManager.AddWebPart(xlvWebpart_Global, "UsersZone", 0);
                wpManager.SaveChanges(xlvWebpart_Global);

                web.Update();
            }

        }

3 Answers 3

7

Performing these steps should resolve your issue:

  1. Login to a farm server (that hosts SharePoint Server) as the farm setup user administrator account.
  2. Launch Central Administration as administrator.
  3. Go: Application Management > Service Applications > Manage service applications.
  4. Select (don't click on) your user profile service application.
  5. Up above, on the Service Applications ribbon, click the Permissions button.
  6. Add the farm setup administrator account.
  7. Enable Full Control for this account.
  8. Click OK.
    EDIT:
  9. IISRESET (it didn't work for me without this)

Source: http://social.technet.microsoft.com/wiki/contents/articles/24839.sharepoint-2013-userprofileapplicationnotavailableexception-profilepropertycache-does-not-have.aspx

5
  • Thanx Slaven. Already I tried the above solution, however the error persists. I added Administrator and ServiceUser accounts and provided Full control.
    – Adi
    Commented Dec 21, 2014 at 9:02
  • I had the same issue. Did you try to add perms to every service account just to eliminate the obvious? Commented Dec 21, 2014 at 9:19
  • I suspected about the permissions and added the same. My User Profile Service and User Profile Synchronization service are also running. I tried to reset both also restarted the server. could not resolve the issue.
    – Adi
    Commented Dec 21, 2014 at 10:10
  • xlvWebpart_Global.AuthorizationFilter = string.Format("{0};;;;", audienceManager_G.GetAudience(strG).AudienceID); In the above line I removed AudienceID, and added SharePoint group which is the Last argument for the AuthorizationFilter. Also I removed AudienceManger from my code which is of no use. Now My Code looks like xlvGlobal.AuthorizationFilter = string.Format(";;;;{0}", strG ); And wpManager.SaveChanges(xlvWebpart_Regional); throws me Object Null Reference Exception. I removed this line too and my code works correct.
    – Adi
    Commented Dec 24, 2014 at 7:22
  • 3
    Important: the process running the code has to be restarted after the permission change in SP. In my case I had to restart PowerShell. Commented Aug 5, 2015 at 9:29
1

We ran into the same error but it was caused by some IIS Application Pools that were stopped after SharePoint Software Updates. Just had to start them again.

1

I had the same UserProfileApplicationAvailableException error in my ULS logs.

I tried a lot of stuff including rebuilding my UserProfileApplication.

Followed some of the steps in the UPS guide here: http://www.harbar.net/articles/sp2010ups.aspx.

I was able to successfully rebuild the UserProfileApplication, but it was still not working.

I noted another error I discovered when analyzing the UserProfileApplication via powershell.

To list out the proxies:

Get-SPServiceApplicationProxy 

To Get the ups proxy:

$ups=Get-SPServiceApplicationProxy -Identity [GUID of UPS Proxy]

To display the information on the proxy:

$ups | Format-List

In the $ups.ServiceEndPointUri information, I found a reference to the url to the topology service in the query string.

authority=https://[SERVER]:32844/Topology/topology.svc

So, I tried accessing it.

I discovered that the service was unavailable because of lack of memory. Memory gates checking failed because the free memory (1398493184 bytes) is less than 5% of total memory. https://stackoverflow.com/questions/16119546/wcf-service-with-full-memory-error-memory-gates-checking-failed-because-the-fre

So, basically, web services on the servers were not working due to lack of memory. I had a measely 8 Gigs of RAM per web front end. But, since I can't just summon memory on the fly, one possibility is to set the following in web.config:

<configuration>
  <system.serviceModel>
    <serviceHostingEnvironment ... minFreeMemoryPercentageToActivateService="0" />
  </system.serviceModel>
</configuration>

However, instead I decided to configure IIS to automatically recycle the web app pools once they exceed 900,000 KB by configuring the Private Memory Limit Recycling setting of the application pools of the SharePoint web applications. Note: you can probably set this higher on your priority web applications if you have the memory to spare.

After making these adjustments, SharePoint web services started working again, the "Unable to load profile" error went away, and My Sites returned to working condition.

****** EDIT ******* Later, I discovered that 900,000 KB was not enough, because the app pools recycled too often. I later changed the recycle Private Memory Limit settings to a higher setting (around 2,000,000 KB) and was able to double the RAM on my front end servers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.