<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-CA" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">I&#8217;ve just recently found suds, but have been using python for quite a while now.&nbsp; Suds looks great.&nbsp; I&#8217;m having an issue with combining suds and sharepoint.&nbsp; I have been able to get a few different commands to function correctly, like creating
 a folder, but haven&#8217;t gotten copyintoitems to work yet. &nbsp;Getting it to go was the original reason I ended up finding suds.<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">The documentation seems to suggest that I need to build the XML elements manually and then pass them to the service rather than a string, specifically for the destinationurls.&nbsp; When I attempt this I do not get any text content in those
 elements (they just end &lt;DestinationUrls/&gt; rather than being &lt;DestinationUrls&gt;&lt;string&gt;some text&lt;/string&gt;&lt;/DestinationUrls&gt;).&nbsp; Has anyone used the webservices in sharepoint with suds to upload files?&nbsp; Is there something obvious that I am missing?<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">Thanks for any help you may be able to provide.<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">Tim<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#0D0D0D;mso-style-textfill-fill-color:#0D0D0D;mso-style-textfill-fill-alpha:100.0%">import suds<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#0D0D0D;mso-style-textfill-fill-color:#0D0D0D;mso-style-textfill-fill-alpha:100.0%">import base64<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#0D0D0D;mso-style-textfill-fill-color:#0D0D0D;mso-style-textfill-fill-alpha:100.0%">import os<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#0D0D0D;mso-style-textfill-fill-color:#0D0D0D;mso-style-textfill-fill-alpha:100.0%">import logging<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#0D0D0D;mso-style-textfill-fill-color:#0D0D0D;mso-style-textfill-fill-alpha:100.0%">from suds.transport.https import WindowsHttpAuthenticated<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#0D0D0D;mso-style-textfill-fill-color:#0D0D0D;mso-style-textfill-fill-alpha:100.0%">from suds.sax.element import Element<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#0D0D0D;mso-style-textfill-fill-color:#0D0D0D;mso-style-textfill-fill-alpha:100.0%">from suds.sax.attribute import Attribute<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#0D0D0D;mso-style-textfill-fill-color:#0D0D0D;mso-style-textfill-fill-alpha:100.0%"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#0D0D0D;mso-style-textfill-fill-color:#0D0D0D;mso-style-textfill-fill-alpha:100.0%">logging.basicConfig(level=logging.INFO)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#0D0D0D;mso-style-textfill-fill-color:#0D0D0D;mso-style-textfill-fill-alpha:100.0%">logging.getLogger('suds.transport').setLevel(logging.DEBUG)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#0D0D0D;mso-style-textfill-fill-color:#0D0D0D;mso-style-textfill-fill-alpha:100.0%"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#0D0D0D;mso-style-textfill-fill-color:#0D0D0D;mso-style-textfill-fill-alpha:100.0%">ntlm = WindowsHttpAuthenticated(username='obscured', password='obscured')<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#0D0D0D;mso-style-textfill-fill-color:#0D0D0D;mso-style-textfill-fill-alpha:100.0%">client = suds.client.Client('http://obscured/gis/_vti_bin/copy.asmx?WSDL', transport=ntlm)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#0D0D0D;mso-style-textfill-fill-color:#0D0D0D;mso-style-textfill-fill-alpha:100.0%"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#0D0D0D;mso-style-textfill-fill-color:#0D0D0D;mso-style-textfill-fill-alpha:100.0%">theSourceUrl = Element('ns1:SourceUrl').setText(&quot;something.pdf&quot;)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#0D0D0D;mso-style-textfill-fill-color:#0D0D0D;mso-style-textfill-fill-alpha:100.0%">theDestinationURLs = Element('ns1:DestinationUrls')<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#0D0D0D;mso-style-textfill-fill-color:#0D0D0D;mso-style-textfill-fill-alpha:100.0%">theString = Element('string').setText('http://obscured/GIS/One%20Line%20Maps/Work%20Depot%20by%20Scale')<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#0D0D0D;mso-style-textfill-fill-color:#0D0D0D;mso-style-textfill-fill-alpha:100.0%">theDestinationURLs.append(theString)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#0D0D0D;mso-style-textfill-fill-color:#0D0D0D;mso-style-textfill-fill-alpha:100.0%">theFields = Element('ns1:Fields')<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#0D0D0D;mso-style-textfill-fill-color:#0D0D0D;mso-style-textfill-fill-alpha:100.0%">theFieldInformation = Element('FieldInformation')<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#0D0D0D;mso-style-textfill-fill-color:#0D0D0D;mso-style-textfill-fill-alpha:100.0%">theFields.append(theFieldInformation)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#0D0D0D;mso-style-textfill-fill-color:#0D0D0D;mso-style-textfill-fill-alpha:100.0%">sampleBytes = 'AwMDExODQ5MjcgMDAwMDAgbgowMDAxMTg1MTA2IDAwMDAwIG4KMDAwMDAwODA5NiAwMDAwMCBuCnRyYWlsZXIKPDwvU2l6ZSA2Mzg'&nbsp;
 #Excerpt from the actual bytes of the file I am uploading <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#0D0D0D;mso-style-textfill-fill-color:#0D0D0D;mso-style-textfill-fill-alpha:100.0%">theStream = Element('Stream').setText(sampleBytes)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#0D0D0D;mso-style-textfill-fill-color:#0D0D0D;mso-style-textfill-fill-alpha:100.0%"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#0D0D0D;mso-style-textfill-fill-color:#0D0D0D;mso-style-textfill-fill-alpha:100.0%">theResult = client.service.CopyIntoItems(theSourceUrl,theDestinationURLs,theFields,theStream)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#0D0D0D;mso-style-textfill-fill-color:#0D0D0D;mso-style-textfill-fill-alpha:100.0%">theResult = client.service.CopyIntoItems(&#8216;something.pdf&#8217;, theDestinationURLs, &#8216;&#8217;, sampleBytes)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#0D0D0D;mso-style-textfill-fill-color:#0D0D0D;mso-style-textfill-fill-alpha:100.0%"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#0D0D0D;mso-style-textfill-fill-color:#0D0D0D;mso-style-textfill-fill-alpha:100.0%"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#0D0D0D;mso-style-textfill-fill-color:#0D0D0D;mso-style-textfill-fill-alpha:100.0%">Request 1:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#0D0D0D;mso-style-textfill-fill-color:#0D0D0D;mso-style-textfill-fill-alpha:100.0%">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&lt;SOAP-ENV:Envelope xmlns:ns0=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:ns1=&quot;http://schemas.microsoft.com/sharepoint/soap/&quot;
 xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:SOAP-ENV=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;&lt;SOAP-ENV:Header/&gt;&lt;ns0:Body&gt;&lt;ns1:CopyIntoItems&gt;&lt;SourceUrl/&gt;&lt;DestinationUrls/&gt;&lt;ns1:Fields&gt;&lt;/ns1:Fields&gt;&lt;Stream/&gt;&lt;/ns1:CopyIntoItems&gt;&lt;/ns0:Body&gt;&lt;/SOAP-ENV:Envelope&gt;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#0D0D0D;mso-style-textfill-fill-color:#0D0D0D;mso-style-textfill-fill-alpha:100.0%"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#0D0D0D;mso-style-textfill-fill-color:#0D0D0D;mso-style-textfill-fill-alpha:100.0%">Request 2:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;color:#0D0D0D;mso-style-textfill-fill-color:#0D0D0D;mso-style-textfill-fill-alpha:100.0%">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&lt;SOAP-ENV:Envelope xmlns:ns0=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:ns1=&quot;http://schemas.microsoft.com/sharepoint/soap/&quot;
 xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:SOAP-ENV=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;&lt;SOAP-ENV:Header/&gt;&lt;ns0:Body&gt;&lt;ns1:CopyIntoItems&gt;&lt;ns1:SourceUrl&gt;something.pdf&lt;/ns1:SourceUrl&gt;&lt;DestinationUrls/&gt;&lt;ns1:Fields&gt;&lt;/ns1:Fields&gt;&lt;ns1:Stream&gt;AwMDExODQ5MjcgMDAwMDAgbgowMDAxMTg1MTA2IDAwMDAwIG4KMDAwMDAwODA5NiAwMDAwMCBuCnRyYWlsZXIKPDwvU2l6ZSA2Mzg&lt;/ns1:Stream&gt;&lt;/ns1:CopyIntoItems&gt;&lt;/ns0:Body&gt;&lt;/SOAP-ENV:Envelope&gt;<o:p></o:p></span></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
</body>
</html>

<table><tr><td bgcolor=#ffffff><font color=#000000><pre>Confidentiality Notice - The email communication is considered confidential
and is intended only for the recipient(s). If you received this email in error,
please contact the sender and delete the email. Unauthorized disclosure or
copying of this email is prohibited.

Attachment Limits - Emera will not accept email larger than 10MB or emails 
containing high risk attachments like ZIP, EXE or others that could contain viruses.
If you have a business need to send such an email, please contact the recipient for instructions.</pre></font></td></tr></table>