We help IT Professionals succeed at work.

VBA DOMDocment Load Method - Access Denied if not Admin

tph1100
tph1100 asked
on
932 Views
Last Modified: 2008-01-09
I am attempting to load an XML document using DOMDocument.load from a VBA program in MS Word. When I do so from an account with Administrators group privileges, all works OK. When I do so from a Users group account, I get Access Denied errorCode -2147024891.  How do I load an XML document using the DOMDocument and subsequent MSXML2.IXMLDOMLIST/NODE without Admin privileges? Can domcnfg be used to make the COM object operate at the correct permission level? How? I am very new at VB and XML... please help.... thanks.
Comment
Watch Question

Commented:
try to add permission to the registry keys of "Classes" which contains DOMDocument objects by using "regedt32". when Users groups has the permission to access the keys, it should be worked.

Author

Commented:
Turns out this was not a DOMDocument issue, but rather a .NET/SharePoint permissions issue. I was calling a class that called a function requiring admin permissions. I used impersonation and encrypted uid/pw in a registry key to solve the problem.  Here are the steps:

1. Go to: http://support.microsoft.com/default.aspx?scid=kb;en-us;329290 and download the aspnet_setreg.exe package.
2. Unzip the package and please in an appropriate “Tools” folder. This solution may be used by any .NET webService requiring permissions beyond Users.
3. From a command prompt navigate to the directory containing the apsnet_setreg program and enter the following:
• Aspnet_setreg -k:Software -u:DomainName\User_ID -p:PASSORD
4. At this point, a registry key HKEY_LOCAL_MACHINE\SOFTWARE\ASPNET has been created with the encrypted user_id and password.
5. Using regedt32, edit the created key HKEY_LOCAL_MACHINE\SOFTWARE\ASPNET
• Change the name of key, if desired.
• Change the name of the key attribute userName (to uid for example)
• Change the name of the key attribute password (to pwd for example)
6. Edit the web.config file for the webService .Ensure the following 2 lines are present in the web.config (all entries are case sensitive):
<authentication mode=”Windows” />
<identity impersonate=”true” userName=”registry:HKLM\Software\ASPNET,uid” password=”registry:HKLM\Software\ASPNET,pwd” />

Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.