Follow

CRM 4.0 Header Injection

You can use the following logic to conditionally inject CRM Headers into messages orginating from Pipelines, Adapters or other non proxy clients..

 

string tokenHeaderName = "http://schemas.microsoft.com/crm/2007/WebServices/CrmAuthenticationToken";
string prefix = "soap_headers";
string propCheck =  context.Data.GetProperty(prefix,tokenHeaderName);
string orgName = "[Your Org Name Goes Here]";
if(string.IsNullOrEmpty(propCheck))
{
 context.Data.SetProperty(prefix,tokenHeaderName,
  string.Format(@"<CrmAuthenticationToken xmlns=""http://schemas.microsoft.com/crm/2007/WebServices"">
      <AuthenticationType xmlns=""http://schemas.microsoft.com/crm/2007/CoreTypes"">0</AuthenticationType><OrganizationName xmlns=""http://schemas.microsoft.com/crm/2007/CoreTypes"">{0}</OrganizationName><CallerId xmlns=""http://schemas.microsoft.com/crm/2007/CoreTypes"">00000000-0000-0000-0000-000000000000</CallerId>
     </CrmAuthenticationToken>"
     ,orgName));
}

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk