- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
We have a requirement to upload a number of documents which are sitting on our SharePoint site into the Managed Documents area of Servicenow.
i have been looking around and found a few links which provided some assistance and pointers, this being a v good example
http://wiki.servicenow.com/index.php?title=AttachmentCreator_SOAP_Web_Service
Still not quite what I wanted.
In the end, I have downloaded the documents from our SP site to an area on my machine.
I have created 2 x Web services in Service now. One is for dms_document and one is for dms_document_revision
I then wrote a VBS routine (yeah, yeah, i know but I have a lot of old VBS code from other old projects / routines that could be bolted together)
This routine will do the following
- Check the folder you provide exists
- for each file in the folder
- create a dms_document based on the file name
- create a dms_document_revision based on the file name and the sys_id from the dms_document
- Encode the attachment to Base64 and from the extension, try to establish the MIME Type
- send the attachment over via the attachment creator and linking it to the dms_document_revision sys_id from the new record above
You have to run the routine via cscript as it is showing you the file it is processing and the sys_id's that are returned
If it fails to get a sys_id from Servicenow, it will STOP.
Things you need to do first
Download the two files,. the XML file needs to be imported to your site - it creates 2 x web services
the TXT file needs to be renamed to VBS
Once downloaded, inside the VBS file there is a line (18) where you need to enter your site's details
You may also want to look at lines 97 and 98 as these refer to a couple of fields in the dms_document area and are coded to a couple of specific values that we always use. One is the audience and the other is the classification
To run the routine, import and commit the XML file
make sure you have a folder on you machine with a file in it.
make sure you have amended the line 18
Running the routine
run the command by
cscript wsdl.vbs "username" "password" "path to file(s)"
If you do not provide the 3 required parameters, it will provide a usage screen
It can take some optional parameters too so you can amend the Requested By, Owned By, Type and Author fields when importing files
these are all options to the command, but if you plan to miss one of the options off, double quote at that point.
In this example,it will make Julian Poyntz the Requsted by, leave the owner field alone and sets the type to be SOP-Data Centre (no need to do anything to the Author parameter)
cscript wsdl.vbs "username" "password" "path to file(s)" "Julian Poyntz" "" "SOP-Data Centre"
In this example, it will make John Doe the Requested by, Jane Doe the owner, leave Type alone and set Jonny Doe as the Author
cscript wsdl.vbs "username "password" "path to file(s)" "John Doe" "jane doe" " "Jonny Doe"
Hope this helps someone at some point
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.