Unable to view attachment that was added to item using AddAttachment web method.


Badge +2

Hi all,

 

I setup a Call Web Service activity in my workflow design and within this activity, I am calling the AddAttachment web method. The AddAttachment is pulling a file from my local PC to upload to my SharePoint site.

 

I supplied the required criteria (just note from screenshot, I did not include the actual domain/username or paths for security reasons.

 

List Name - Name of my list

List Item ID - Item ID of an item within the above list

File Name - Path of and to the actual file I want to add to my item.

Attachment - I specified FileData

2742i7406F962D911D99C.jpg

The Call Web Service and AddAttachment web method do work... As you can see from the next screenshot the FileName.jpg appears at the bottom of my List Item.
2743iEC5948A3A3310FBD.jpg

I click the "SampleInvoice1.jpg" hyperlink and it results in the following:

2744i131E376A0453437E.jpg

I tried recording everying using Log in History but no warnings/errors.

Any ideas?

Thanks,

 

Steve


6 replies

Userlevel 5
Badge +14

that's a "feature" of combination SP+IE.

if you tried with different browser, or if you uploaded picture as (eg) png it would be shown correctly

Badge +2

Hi Emha,


Thanks for your reply. I'm afraid you get similar behavior on Google Chrome. See image below. The a small image placeholder. No warnings or errors. I feel that the image is not actually being uploaded to SharePoint. Also, you get similar behavior when you try and upload a .PNG file using the same web method.
2745i03652A610CCE78F6.jpg

Thanks,

Steve

Userlevel 5
Badge +14

I've looked closer on your configuration and there are few issues

 

- file name should have been the name of the target attachemnt, not your 'local' file.

btw, webservice runs on the server it doesn't have any access to your local resources

 

- attachment tag content should have been base64 encoded file content. so in your case, string "FileData" was base64 decoded and the result saved into attachemnt, hence you do not get any senseful picture displayed

Badge +2

Hi Emha,

 

Yes, my team and I saw that too yesterday prior to your response.

 

We used a website to convert the PDF file to base64binary and pasted that information into the the following area in the Web Service action/Web Method. There is obviously alot more information going into that attachment element, I just provided a snippet of it.

<m:fileName>SampleDoc.pdf</m:fileName>

<m:attachment>JVBERi0xLjQKJcfsj6IKNSAwIG9iag</m:AddAttachment>

 

I published my workflow and started a new workflow instance on my list item and it successfully added the PDF to my list item and I was able view the PDF without issue.

 

So my question is, does Nintex Workflow 2013/2016 etc have the ability to convert a PDF doc to base64binary so that I do not need to go to some website to convert that information and paste that information into the attachment element?

Thanks again,

Steve

Badge +2

Emha,

 

I want to clarify: we are trying to add an attachment from a File System to a List Item using the AddAttachment web method inside a "Call web service" action. Can this be done? If yes, do you have examples of this being done.

 

Thanks,

 

Steve

Userlevel 5
Badge +14

So my question is, does Nintex Workflow 2013/2016 etc have the ability to convert a PDF doc to base64binary so that I do not need to go to some website to convert that information and paste that information into the attachment element?

no, unfortunately, there is not such an action.

 

 

 

I want to clarify: we are trying to add an attachment from a File System to a List Item using the AddAttachment web method inside a "Call web service" action. Can this be done? 

the AddAttachment method doesn't accept an URL/UNC as an input. it only works with base64 encoded stream.

nor there is any other action that would perform a copy from a filesystem to a sharepoint (there is just an action "Copy to FileShare" that does it opposite way). you'll have to find a different way how to proceed.

 

similar topic has been discussed eg.here - https://community.nintex.com/t5/Nintex-for-SharePoint/Copy-file-from-fileshare-to-sharepoint-document-folder/m-p/25641

it links to a solution with powershell script that performs the copy.

but maybe more suitable approach for you would be to use a sharepoint's document library as a place where your users store docuements instead of a fileshare. document library can be accessed by a file browser like a regular files system (see icon Open with explorer on the ribbon). users need not notice they work with a SP library and not with a fileshare.

 

 

Reply