Access Denied When Using MigrateUserAccount

I am attempting to programmatically change the LoginName of forms auth users when they change their username in our system (outside of Sharepoint). I am using the following code within a custom web service:
[WebMethod]
public bool MigrateUser(string oldUsername, string newUsername)
bool result = true;
SPSecurity.RunWithElevatedPrivileges(delegate()
try
Microsoft.SharePoint.Administration.SPFarm farm = Microsoft.SharePoint.Administration.SPFarm.Local;
farm.MigrateUserAccount(oldUsername, newUsername, false);
catch (Exception e)
result = false;
return result;
The oldUsername and newUsername variables are in the format of "i:0#.f|SPMembershipProvider|[email protected]". When running this code, the following exception is thrown:
Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED));    at Microsoft.SharePoint.Utilities.SPUtility.HandleAccessDenied(Exception ex)
   at Microsoft.SharePoint.Library.SPRequest.SelectSitesAndUserInfoForMigration(Object& pvarContentDsns, Object& pvarContentIds, String bstrOldLogin, String bstrNewLogin, String bstrFullUserKey, Boolean bEnforceSidHistory, String& pbstrNewLogin,
Byte[]& ppsaOldSid, Byte[]& ppsaNewSid, Object& pvarSidHistory, Object& pvarSiteIds)
   at Microsoft.SharePoint.Administration.SPFarm.MigrateUserOrGroup(String oldLogin, String newLogin, Boolean usersOnly, Boolean enforceSidHistory)
   at Microsoft.SharePoint.Administration.SPFarm.MigrateUserAccount(String oldLogin, String newLogin, Boolean enforceSidHistory)
   at CustomSPWS.SSUVBRSvc.<>c__DisplayClass34.<MigrateUser>b__33()
The user that this is running under is a farm admin and has Full Control permissions on the User Profile Service Application.
Any idea on what may be causing this access denied error, and how I might be able to resolve it?
Thank you,
Matt

1. Did you select Run as administrator in powershell
When I perform this operation in PowerShell (logged in with the same user) it succeeds. However, when trying to do the operation programmically, it fails.
2. Is user you trying to this command through has owner permission on config and content db
Yes, the user has db_owner permission on the config and content databases.
3. Does he have administrator permission on sharepoint system
The user is a farm administrator and has WSS_ADMIN_WPG, WSS_RESTRICTED_WPG_V4, WSS_WPG, IIS_IUSRS and Performance Monitor Users group membership on the local machine.
4. please share ULS log and event log when you recreate the issue
This is what is in the SP log when calling my web method:
Entering monitored scope (Request (POST:https://example.com:443/_vti_bin/CustomSPSvc.asmx))
Name=Request (POST:https://example.com:443/_vti_bin/CustomSPSvc.asmx)
dfde587a-2444-4230-8b42-8d118211d6d8
Site=/ dfde587a-2444-4230-8b42-8d118211d6d8
Unknown SPRequest error occurred. More information: 0x80070005
dfde587a-2444-4230-8b42-8d118211d6d8
Leaving Monitored Scope (Request (POST:https://example.com:443/_vti_bin/CustomSPSvc.asmx)). Execution Time=314.624624079317
dfde587a-2444-4230-8b42-8d118211d6d8
There doesn't appear to be anything relevant logged in the event log.
Thank you,
Matt

Similar Messages

  • Windows 7 Open and Save As dialog box gives an "Access Denied" when using common Windows Explorer features.

    On many computers in our environment we have issues in Windows 7 when using the Common Dialog Box.  Within the dialog box we get the error Access Denied whenever we try to create a folder.  If we try to rename a file it doesn't give an error but
    it doesn't work either.  We cannot delete a file, still no error, but we can create shortcut.
    Within Windows Explorer of the same user it has no issues.
    Even if we run an application as administrator it has the same results.
    Example: Open Paint (right click "Run As Administrator"); then File, "Save As", right-click in empty space; then New, Folder.  This caused the error to popup "Unable to create the folder 'New folder'  Access is denied."
    Thanks for your help,
    Daniel

    Hi Daniel,
    How are things going? As the article provided above said, for such kind of issues generally it is caused by permission settings.
    The article provided several possible solution and please let us know if there is anything unclear about the steps. 
    If you have any feedback on our support, please send to [email protected]

  • Access denied when using Desktop-API

    Hi to all,
    I have a client app that is launched using JWS. In my JNLP file I declared:
    <security>
         <j2ee-application-client-permissions/>
    </security>
    and all jar-files are signed with the same certificate. This is working fine, but when I try to use the Desktop-API to open a folder on clients machine
    Desktop.getDesktop().open(new File("/path/to/dir"));
    it gives me
    java.security.AccessControlException: access denied (java.io.FilePermission <<ALL FILES>> execute)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.awt.Desktop.checkExec(Unknown Source)
         at java.awt.Desktop.open(Unknown Source)
    I even tried with
    <security>
         <all-permissions/>
    </security>
    in JNLP. But it gives me the same Exception. I also tried to use a PrivilegedAction to make SecurityManager not check permissions, but it didn't help. At last thought about having my own policy-file. But I don't know how to tell the JWS app to use it.
    Thanks for help in advance
    Christian

    Hi to all,
    Deleting the cache works fine. But only for one start.
    I found the JNLP in the cache has been automatically updated with the line
    <update check="timeout" policy="always"/>
    I thought this could be the problem, because if may be the SecurityManager finds JNLP in the cache being different from that one on the server, it "thinks" it has been hacked?
    To avoid this difference, I added the line right from the beginning, but that didn't help.
    BTW I signed all my jars, but the JNLP-File is just provided in the working dir of the app unsigned. Somewhere I read about JNLP-Files also signed. May be I have to sign it, too, or is it possible to have it packed in my application jar (then it will be signed with it)?
    Thank for any hints
    Christian

  • Access denied when using IdentityXML with WebGate

    Hello,
    Here is our setup:
    - COREid Identity 7.0.4,
    - COREid Access 7.0.4,
    - WebPass,
    - WebGate,
    - IIS 6 (hosting the identity application)
    We enabled the default policies to protect the /identity URL.
    We are using webservice calls (using C# with WSDL proxies) to query the identity server from other applications.
    Prior to enabling the Access policies this was working fine, now we get an Access denied error message.
    It looks like WebGate is blocking the IDXML calls.
    Does anyone knows what is causing this problem and how to solve it ?
    My first guess was to use the Access SDK to build an obSSOCookie and join it to the request, however the developper guide doesn't provide may examples on how to practically do this. Will it solve my problem ?
    Thank in advance,
    Franck

    Thanks for your answer.
    I eventually found a workaround for this problem.
    Actually you don't need to provide an SSO cookie the first time you connect to the webgate server, you just need to provide basic credentials and the webgate will provide you an SSO cookie that you can use for the next call.
    The problem is that this doesn't work out of the box with the .NET/WSDL framework for some reason (with Java + the HTTPClient library I had no problem).
    I had to had manually the following headers to the HTTP request to make it work:
    Authentication: Basic XXXXXXXX
    Cookie: OBBasicAuth=fromDialog
    Where XXXXXXXX is a base64 encoded string containing "login:password"
    Thanks,
    Franck

  • [W8.1][C#]ACCESS DENIED when using mediaPlayer.SetUriSource

    mediaPlayer.SetUriSource(new Uri(source));
    The source is the music file in windowsphone .(eg. a .mp3 song in MusicLibrary),not in application.
    and then I got this:
    backgroundtaskstate:BackgroundTaskRunning
    Background Task started
    Background Audio Task initialized
    Starting Playback
    trackname
    value found C:\Data\Users\Public\Music\as long as you love me.mp3
    position
    null returned
    Failed with error code System.UnauthorizedAccessException: Access is denied.
    Windward.E7

    Hi 火卡大大,
    The URI is invalid in Windows Store App, for more information please ref:
    File access and permissions
    In this scenario, you should use MusicLibrary.
    --James
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • ACCESS DENIED when using mediaPlayer.SetUriSource

    mediaPlayer.SetUriSource(new Uri(source));
    The source is the music file in windowsphone .(eg. a .mp3 song in MusicLibrary),not in application.
    and then I got this:
    backgroundtaskstate:BackgroundTaskRunning
    Background Task started
    Background Audio Task initialized
    Starting Playback
    trackname
    value found C:\Data\Users\Public\Music\as long as you love me.mp3
    position
    null returned
    Failed with error code System.UnauthorizedAccessException: Access is denied.
    Windward.E7

    Hi 火卡大大,
    The URI is invalid in Windows Store App, for more information please ref:
    File access and permissions
    In this scenario, you should use MusicLibrary.
    --James
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Photoshop cs4 access denied when trying to install from disc in Windows 7 64bit.

    Photoshop cs4 access denied when trying to install from disc in Windows 7 64bit. I tried it in
    safe mode and it starts to install but get an error there as well.
    What do I do?

    So when you put the disk in it won't run correctly? When the disk is inserted you should have a window pop up with 2 options. 1 to install and the other to see what is on the disk. Choose to explore or open the disk. Go to the CS4 folder where the photoshop .exe file is (that will run the setup), right click on the .exe file and choose run as Admin and it should start. See if it will install. If not then read below.
    I am not sure how far you got in the install before so chances are you will have to run the CS4 cleanup utility. 2 levels to run at but don't use 1 or 2 just type in the number 3.
    http://www.adobe.com/support/contact/cs4clean.html
    You may need to run the windows installer cleanup utility too
    http://support.microsoft.com/kb/290301
    Before you try to reinstall the software ensure that adobe reader is not installed. If it is remove it. It has caused issues in the past with vista and CS4 installs.
    Also turn off windows Defender and any anti-virus software. You can keep UAC on in Windows 7.
    During the CS4 install at 90 percent it will almost stop and may take 5 to 10 mins to finish. This is normal. What a pain huh......
    After install is finished, reboot
    After reboot, go to the CS4 64 bit or 32 bit icon (depends on 32 or 64 bit Windows 7) in start area, right click on CS4 64 bit (if you have windows 7 64 bit) and choose properties, compatibility tab and then check run as Admin at the bottom area. Hit apply, ok to close out.
    Now start CS4 and run the updater.

  • ORA-31050: Access denied when try to register XMLSchema

    Dear All
    I got ORA-31050: Access denied
    when tried to run to load XML schema with DBMS_XMLSCHEMA.registerSchema
    Can you advise me what privilege should I grant to the user?
    I tried grant XDBADMIN role but it does nto help
    Thank you in advance
    Artem Rodin

    Dear Mark!
    I realy need you help!
    I can successfully register schema which has complexType declaration as root element, like
    <schema targetNamespace="http://www.oracle.com/PO.xsd"
         xmlns:po="http://www.oracle.com/PO.xsd"
         xmlns="http://www.w3.org/2001/XMLSchema">
    <complexType name="PurchaseOrderType">
         <sequence>
              <element name="PONum" type="decimal"/>
              <element name="Company">
                   <simpleType>
                        <restriction base="string">
                             <maxLength value="100"/>
                        </restriction>
                   </simpleType>
              </element>
              <element name="Item" maxOccurs="1000">
                   <complexType>
                        <sequence>
                             <element name="Part">
                                  <simpleType>
                                       <restriction base="string">
                                            <maxLength value="1000"/>
                                       </restriction>
                                  </simpleType>
                             </element>
                             <element name="Price" type="float"/>
                        </sequence>
                   </complexType>
              </element>
         </sequence>
    </complexType>
    <!--element name="PurchaseOrder" type="po:PurchaseOrderType"/-->
    </schema>
    But I failed if in the root there is element like
    <schema targetNamespace="http://www.oracle.com/PO.xsd"
         xmlns:po="http://www.oracle.com/PO.xsd"
         xmlns="http://www.w3.org/2001/XMLSchema">
    <complexType name="PurchaseOrderType">
         <sequence>
              <element name="PONum" type="decimal"/>
              <element name="Company">
                   <simpleType>
                        <restriction base="string">
                             <maxLength value="100"/>
                        </restriction>
                   </simpleType>
              </element>
              <element name="Item" maxOccurs="1000">
                   <complexType>
                        <sequence>
                             <element name="Part">
                                  <simpleType>
                                       <restriction base="string">
                                            <maxLength value="1000"/>
                                       </restriction>
                                  </simpleType>
                             </element>
                             <element name="Price" type="float"/>
                        </sequence>
                   </complexType>
              </element>
         </sequence>
    </complexType>
    <element name="PurchaseOrder" type="po:PurchaseOrderType"/>
    </schema>
    I got the following error stack
    ORA-01031: insufficient privileges
    ORA-06512: at “XDB.DBMS_XDBZ0”, line 218
    ORA-06512: at “XDB.DBMS_XDBZ”, line 6
    ORA-06512: at line 1
    ORA-06512: at “XDB.DBMS_XMLSCHEMA_INT”, line 0
    ORA-06512: at “XDB.DBMS_XMLSCHEMA”, line 26
    ORA-06512: at “XDB.DBMS_XMLSCHEMA”, line 131
    ORA-06512: at “DVLP.PRIME_BRIDGE”, line 73
    ORA-06512: at line 7
    I guess you can reproduce this in-house,
    It's not my schema it is taken from
    XML Database Developer’s Guide - Oracle XML DB
    Structured Mapping of XMLType 5-3
    Example 5–1 XML Schema Definition, po.xsd
    As far as I understand in the second case Oracle tries to create a table to store XML content and fails to do it.
    User that I used has DBA role. What other privileges should I grant to the user? And/or I should grant some additional privileges to "XDB" user?
    This issue has become critical for me, so I am highly appreciate any assistance
    Many thanks in advance
    Best regards
    Artem Rodin

  • I receive "Database access denied" when trying to add component 4543BD

    I receive "Database access denied" when trying to add component 4543BD to my schematic. This component was added from a previous version. I'm using Multisim version 12.0.0  Student edition.
    Solved!
    Go to Solution.

    Hi Diarra,
    I checked my database and  the  4543 is not in the Student Edition. If you opened a schematic that was created in a higher version such as the Educaiton Edition and copied the part to your database, when you place this part you will get the access denied message. 
    Attached is a schematic with the part, you can open it and build you circuit around it.
    Tien P.
    National Instruments
    Attachments:
    4543.ms12 ‏62 KB

  • Get "Access Denied" when click open a PDF file

    Hi Friends,
    Get "Access Denied" when click open a PDF file linked from SharePoint 2013 page.
    What are the route causes any one is remove the permissions are stopped the inheritance permissions of the library.
    Can anyone face the same issue please help me.
    Thanks,
    Tiru
    tirupal

    Hi,
    If you are able to open the same document earlier,then  anonymous access enabled on your doc library then.
    If you are facing this problem in first time,then you do not have required permission (may be custom permission level has been set ) on it.
    Murugesa Pandian.,MCTS|App.Development|Configure

  • Access Denied when Student Uploads Course in Drop Box

    All of a sudden we are getting access denied when a student tries to upload a course. We have not changed anything on our end. The tabs on the course page are set to drop box for student. The credentials sent over are:
    StudentBody@urn:mace:itunesu.com:sites:school.edu;Student@urn:mace:itunesu.com:s ites:school.edu:SPC16001002134
    The SPC16001002134 is the course identifier.
    Access to the course for student is set to download:
    Access Level: Download
    Credential Definition: Student@urn:mace:itunesu.com:sites:school.edu:${IDENTIFIER}
    Group Access Label: Student

    Hi,
    I need a bit more information. Can you please post your site's domain so that I can inspect it? It appears you have replaced this with school.edu.
    Thanks.

  • I get access denied when I try to search on your site.

    Please help me. I get access denied when I try to search on your site. I have emptied cache. I tried Safe Mode the way you suggested. Still access denied (though my printer then would not respond to me and I spent $85 to have my It consultant fix that problem.

    Hi,
    You've opened 3 different threads for the same issue. Please only open '''ONE''' thread per support request.
    Continue here [https://support.mozilla.org/en-US/questions/995124?esab=a&s=&r=3&as=s /questions/995124]
    Closing thread

  • I get access denied when I add a page to a workset in EP 7

    I get access denied when I add a page to a workset in EP 7.
    Please advice.

    Hello,
    This seems to be a permission issue. Assign the user id proper permission, say system_admin_role and then try.
    Regards
    Deb

  • ACCESS DENIED when trying to use custom site template to create new Subsite

    I am trying to create a new site using a custom template. I am the new admin here at the company. Other also are having "access denied" errors when trying to create the site using these custom templates. 
    However I can still create a site using the out of the box templates. I have given myself site collection admin (primary) and I am a farm administrator as well. Any ideas on why I keep getting access denied to specific templates?
    The entire site collection is using the custom template. When I try to create a new site under the site collection with a custom template now, it says "access denied". Any ideas?
    Thanks!
    Note - I am able to use the Custom Site Templates in the test environment without any issues. Only in the production/live environment am I getting the access denied error.

    I am not finding anything that comes up in the ULS logs about the access denied. I tried creating the site in the test environment using the custom template and it worked. I go to the production environment and try to create the site with the same template
    and get "error:access denied - current user domain\user" I checked in the ULS logs as soon as the access denied appears (pretty quickly after pressing create) and there is nothing at that specific time. This is a huge problem, is there any way to
    work around or fix this? I'm a new admin.

  • Access denied when trying to use PDF printer as normal user

    I have Acrobat 8 professional installed on a computer running Windows XP SP3. When i try to print a document to pdf from any program as Administrator it performs just fine. When i log on as a normal, restricted, user i get the window popup asking for a file name and location and whereever i try to save a file i get "access denied" error.
    Users have right to write and modify in all of the folders i've tried to save to (desktop, my documents, custom made folders), but i think the problem is with the temp file being written to some system folder where restricted users don't have permission to write. Did anyone encounter a similar problem, and how did you solve it? What directories do the normal users need access to in order to perform printing.
    Thank You

    The forum added some nice links and i found my answer here http://forums.adobe.com/message/1179199#1179199 - changed the registry key permissions and it's working like a charm. Thank you.

Maybe you are looking for

  • Delay on playing an instrument (only at the first time)

    Hello, I'm new to Mainstage and have the following problem: Always I open my concert, there is a small delay in all instruments in all patches. But ONLY at the first time, I play the instrument (hit the key). For the rest of the performance everythin

  • LCM of Planning Application

    Hi All, I export all the information from one application using LCM. I got the business rules also. Now when I try to import the exported business rules in another application, all rules imported successfully. But in the calculation manager, I can't

  • Excise values error in migo

    Dear Friends,                 this is chandra shekar , here i had one problem in migo transaction excise values are capturing in wrong way for example the  material price is 100 rs BED is 8 % that is 8 rs when doing goods receipt for this material in

  • Smart Object Transformation in CS5

    Has anyone noticed that when you scale down a smart object in Photoshop CS5, the transformation tool resets the dimensions to 100%? In CS4, you are able to see the transformation properties once you scale down (by option-Shift clicking on the boundin

  • Add search criteria field to ERPQOrder

    I would like to add additional search criteria fields to the Dynamic Query Object ERPQOrder. I want to enhance the class CL_CRM_QORDER_RUN_ERPIL for the purpose. Is there a way to accomplish this requirement?