Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 72043

Error creating Docuref record using AIF & C#

$
0
0

I am a AX newbie trying to create a record in the Docuref table using AIF but I'm running into erros that I can't decipher Can someone help tell me where I'm going wrong?

TIA - Hank Anzis

  Here are the errors I’m getting when I try to write the document record (from the exception Log)

Subsystem

Exception message

The user is not authorized to   perform this action.

AifRequestProcessor-processWcfRequest

The user is not authorized to   perform this action.

AifRequestProcessor-processWcfRequest

Some or all identity references   could not be translated.

Here is the c# code I’m using to populate the record

  documentAttachServiceClient client = new documentAttachServiceClient();

                CallContext cc =  new CallContext();

                cc.LogonAsUser = "AXIntegration";

                AxddocumentAttachPage documentAttachPage = new AxddocumentAttachPage();

                //documentAttachServiceCreateRequest request = new documentAttachServiceCreateRequest();

                AxdEntity_DocuRef[] docurefs = new AxdEntity_DocuRef[1] ;

                AxdEntity_DocuRef docuref = new AxdEntity_DocuRef();

                docuref.TypeId = "file";

                docuref.RefRecId = doc.RecId; //(“5637145332”)

                docuref.RefTableId = tableId; //(“345”)

                docuref.RefCompanyId = Properties.Settings.Default.DefaultCompanyCode; //(“ATI”)

                docuref.ActualCompanyId = Properties.Settings.Default.DefaultCompanyCode; // (“ATI”)

                docuref.Name = lstSource.SelectedItem.ToString(); //(“Individual Report October 1, 2013 133044.PDF”)

                docuref.DocuTemplate = String.Empty;

                docuref.ContactPersonId = String.Empty;

                docuref.RestrictionSpecified = false;

                cc.Company = null;

                documentAttachPage.DocuRef = docurefs;

                docurefs[0] = docuref;

                InvoiceBridge.AttachmentHandling.EntityKey[] returnedEntityKey = client.create(cc, documentAttachPage);


Viewing all articles
Browse latest Browse all 72043

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>