Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Can anyone tell me how to delete a SharePoint user profile remotely? I don't see a way to do this using SharePoint Web Services or User Profile Services. The following code works fine when run on the SharePoint server but will not work remotely. When it tries to the run the constructor for SPSite it throws an error about not being able to find Microsoft.Sharepoint.Intl which is in the GAC on the SharePoint server.

using (new Person.Utilities.Impersonation.Impersonator("sharepoint.service", "fakeDomain", "fakePassword", Person.Utilities.Impersonation.LogonType.LOGON32_LOGON_NEW_CREDENTIALS, Person.Utilities.Impersonation.LogonProvider.LOGON32_PROVIDER_WINNT50))
{
    using (SPSite site = new SPSite("https://www.mySharepointSite.com/"))
    {
        ServerContext context = ServerContext.GetContext(site);
        UserProfileManager profileManager = new UserProfileManager(context);
        if (profileManager.UserExists(username))
        {
            profileManager.RemoveUserProfile(username);
        }
    }
}
share|improve this question
    
Pretty sure this just can't be done remotely. You'll need to create a web service or in some other way have code running on the server that you trigger remotely. –  Servy Aug 23 '12 at 15:52
    
You would have to use the REST based API or write your own web service. Server OM code must run on the server. –  Robert Kaucher Aug 23 '12 at 15:58
add comment

migrated from stackoverflow.com Aug 24 '12 at 12:56

This question came from our site for professional and enthusiast programmers.

1 Answer

Have you checked out this article. This guy is using WCF to update the user profile properties. Hope this helps.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.