Hello
I have written a console application to add registerated users to AD and also trying to create the Sharepoint (2013) profiles for them (as the idea is that (extranet) user's may change their profiles and the changes will be migrated to AD.
I think I should have all the main parts of the program fine, except that when I try to add a new profile to the Sharepoint, the try -catch catches and gives an error mesage like this:
Microsoft.Office.Server.UserProfiles.UserProfileApplicationNotAvailableException
: UserProfileApplicationNotAvailableException_Logging :: UserProfileApplicationP
roxy.ApplicationProperties ProfilePropertyCache does not have 85aa22c1-a337-412d
-8e94-71a3cdc4f21f
I have harvested the google and have done so far the following checks /and/or corrections:
I have started the Sharepoint Profile Synchronisation Service (and yes, also restarted the SP Timer AND run the IIS after that). I have checked that my account has db_owner rights on ProfileDB.
I have no problems in migrating data from AD to Sharepoint profiles, so the profile service should be fine.
The code is like the following (mostly grabbed from Internet)
if (add2List != "") {
// Add to sharepoint list....
SPGroup oGroup = web.SiteGroups[add2List];
SPUser oUser = web.AllUsers[account];
oGroup.AddUser(oUser);
}
SPServiceContext serviceContext = SPServiceContext.GetContext(site);
try
{
// Create a user profile that uses the default user profile
// subtype.
UserProfileManager userProfileMgr = new UserProfileManager(serviceContext);
UserProfile userProfile = userProfileMgr.CreateUserProfile(account);
Console.WriteLine("A profile was created for " + userProfile.DisplayName);
}
catch (System.Exception e)
{
Console.WriteLine(e.GetType().ToString() + ": " + e.Message);
Console.Read();
}
Any ideas what to try next?wbr
hank