问题
guys!:) I work with CRM 2011 & I need to automatically generate download link for attachments in entities records with C# plugin via attachment GUID.
This link looks like this:
/SERVER/ORGANIZATION_NAME/Activities/Attachment/download.aspx?AttachmentType=5& AttachmentId={GUID}&IsNotesTabAttachment=1&CRMWRPCToken=8oi054LNEeOd7QAVXZNIANwO8jNsflfFQ75fqPK2zC4Az6I2yWatX71ugBe7bgHy&CRMWRPCTokenTimeStamp=635273624756233624
But I haven't got any idea, how to get these CRMWRPCToken&CRMWRPCTokenTimeStamp. Could anybody help me? Thanks.
回答1:
You cannot generate the CRMWRPCToken & CRMWRPCTokenTimeStamp values. You shouldn't need to as these will be handled by CRM itself when the URL is called. The user making the call will need to authenticate to CRM - if they are to be anonymous users you'll need to put a proxy site between the caller and CRM that can support anonymous users - CRM can't support anonymous users directly.
The best, and most easily supported way to do this, is to direct the user to an HTML WebResource with the annotation's guid in the URL. Then in the WebResource take the URL and call Xrm.Utility.openEntityForm("annotation", annotationid) to open a dialog to download the file. Assuming the user is authenticated to CRM this will work great and you never need to worry about it breaking.
来源:https://stackoverflow.com/questions/21624351/how-to-get-programmaticallyvia-plugin-crmwrpctoken-crmwrpctokentimestamp-in