web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Setting LogonAsUser when calling Query Service

(0) ShareShare
ReportReport
Posted on by

Is there some permission required to allow a user to specify LogonAsUser in a request to the Query Service? I can successfully call the service, however when I include LogonAsUser I get "Failed to log on to Microsoft Dynamics."

I read in article https://technet.microsoft.com/en-us/library/hh582244.aspx that "The data contract for the call context is not published as part of the Web Service Description Language (WSDL) files for the query service and the metadata service. If you want to set any call context values for these services, you must create the code to set the values for the system service call."

I've done this and when I specify a Company this works, however when I also include LogonAsUser I get the error "Failed to log on to Microsoft Dynamics."

Example header of the request below:

<s:Envelope xmlns:a="www.w3.org/.../addressing" xmlns:s="www.w3.org/.../soap-envelope">
<s:Header>
<a:Action s:mustUnderstand="1">tempuri.org/.../ExecuteQuery&lt;/a:Action>
<a:MessageID>urn:uuid:d506fbb5-9eac-4517-9d38-8bbb85ec785b</a:MessageID>
<a:ReplyTo>
<a:Address>www.w3.org/.../anonymous&lt;/a:Address>
</a:ReplyTo>
<CallContext xmlns="schemas.microsoft.com/.../datacontracts">
<Company>company</Company>
<LogonAsUser>domain\user</LogonAsUser>
</CallContext>
</s:Header>

...

*This post is locked for comments

I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 39

#2
Michel ROY Profile Picture

Michel ROY 14

#3
imran ul haq Profile Picture

imran ul haq 8

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans