Upload files to SharePoint from K2 XML Field

  • 25 August 2009
  • 6 replies
  • 2 views

Badge +7

Hi,


Is it possible to upload files saved on a server directory with full paths stored in K2 XML field to MOSS, using K2 Field option of ShrePoint Documents event wizard?


I tried many times, but everytime if fails with an error: "Invalid character in a Base-64 string"


my XML field looks exactly as:


<?xml version="1.0" ?>



- <spsdocuments>



- <document id="1">



  <docname>list1.xls</docname>


  <filefullurl>C:list1.xls</filefullurl>

  </document>


- <document id="2">



  <docname>functions.JPG</docname>


  <filefullurl>C:functions.JPG</filefullurl>

  </document>


- <document id="3">



  <docname>unattend.txt</docname>


  <filefullurl>C:unattend.txt</filefullurl>

  </document>

  </spsdocuments>

I pointed "filefullurl" as a source for document field and "docname" as a source for filename field, checked then "filefullurl" is a repeating node.


What am I doing wrong?? 


 Regards,


6 replies

Badge +2

Hi there,


all you have to do is convert it to Base-64 type and rerun it it should work.


I recently got such problem solved in my workflow

Badge +11

Just a thought...


Referencing a local file like C:functions.JPG is fine when you have only one K2 server, but when you are using a load balanced configuration you can't be sure which K2 server your process will execute on.  You may have to create a share somewhere so a load balanced configuration could always find the location of a file by specifying the full path to the file like  //server/path/file

Badge +2
I agree on this point. if it is a standalone installation c:....should work or else you need to go with the complete server url
Badge +7

Thank you for your comments!


It's a standalone K2 server installation so it should works. I'll try now follow your advise.

Badge +7

Well, the event raise no errors anymore but I get another one. As a result of SharePoint Documents event it creates files in SharePoint Library, but the content of these files is corrupted - if i open a file that was copied (I thought so) to Sharepoint, I can see the field value (i.e. "C:TempFolderlist1.xls") as a content of the file. Filenames are correct, types are also correct (XLS, DOC, TXT, JPG, etc) but the content is replaced with path strings :(


Do you have any thoughts why?

Badge +7

Finally solved..


I thought K2 Field should contain the path to the file (like in case I submit the file from a server location), and after I replaced it with a byte field with the content it works fine.

Reply