Sharepoint & PHP

In: PHP

8 Dec 2005

I was interested in integrating PHP and SharePoint services, and using Microsoft Word 2003 (Or other MS Office Products) to upload documents directly to PHP, here are some of my observations.

There are two processes winword.exe itself pyshically POST’s the word document on the server, another process called dssm.exe (Microsoft Office Document Update Utility), which manages updates.

Sharepoint Document

Analyzing the http protocol, whilst utilizing shared workspaces in Microsoft Word 2003 initialially authenticates via NTLM and the following protocols are listed in OPTIONS: [GET, POST, OPTIONS, HEAD, MKCOL, PUT, PROPFIND, PROPPATCH, DELETE, MOVE, COPY, GETLIB, LOCK, UNLOCK]; Which means Apache would have to be configured to accept some of the protocols.

Once authenticated the following occurs:

WinWord.exe Upload to SharePoint

WinWord.exe Update to SharePoint

Some example requests.

POST

POST /SharePoint%20Services(1)/_vti_bin/_vti_aut/author.dll HTTP/1.1
Accept: auth/sicily
Content-Length: 20207
Content-Type: application/x-vermeer-urlencoded
X-Vermeer-Content-Type: application/x-vermeer-urlencoded
Connection: Keep-Alive

method=put+document%3a6%2e0%2e2%2e6356&service%5fname=%2fSharePoint+Services%281%29&document=%5bdocument%5fname%3dShared+Documents%2fSharePoint+Services%2edoc%3bmeta%5finfo%3d%5b%5d%5d&put%5foption=edit&comment=&keep%5fchecked%5fout=false

method=put+document:6.0.2.6356&service_name=/SharePoint+Services(1)&document=%5Bdocument_name=Shared+Documents/SharePoint+Services.doc;meta_info=%5B%5D%5D&put_option=edit&comment=&keep_checked_out=false

Response

HTTP/1.1 200 OK
Connection: close
Date: Tue, 08 Nov 2005 21:26:55 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
MicrosoftSharePointTeamServices: 6.0.2.6411
Content-type: application/x-vermeer-rpc

<html><head><title>vermeer RPC packet</title></head>
<body>
<p>method=put document:6.0.2.6356
<p>message=successfully put document 'Shared Documents/SharePoint Services.doc' as 'Shared Documents/SharePoint Services.doc'
<p>document=
<ul>
<li>document_name=Shared Documents/SharePoint Services.doc
<li>meta_info=
<ul>
<li>vti_approvallevel
<li>SR|
<li>vti_categories
<li>VW|
<li>vti_filesize
<li>IR|19968
<li>vti_assignedto
<li>SR|
<li>Checked by
<li>SW|Andrew M. Johnstone
<li>Department
<li>SW|Development
<li>vti_modifiedby
<li>SR|C22586_40180\administrator
<li>vti_timecreated
<li>TR|08 Nov 2005 21:26:56 -0000
<li>vti_title
<li>SR|SharePoint Services
<li>vti_timelastmodified
<li>TR|08 Nov 2005 21:26:56 -0000
<li>_SharedFileIndex
<li>SW|0000020000000000{54AD31DF-B8AF-4070-A579-F3A63D6C202F}http://sharepoint.hostelhost.com/SharePoint Services(1)/Shared Documents/SharePoint Services.doc
<li>vti_author
<li>SR|C22586_40180\administrator
<li>vti_sourcecontrolversion
<li>SR|V1
<li>vti_sourcecontrolcookie
<li>SR|fp_internal
</ul>
</ul>
</body>
</html>

POST

POST /SharePoint%20Services(1)/_vti_bin/dws.asmx HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: http://schemas.microsoft.com/sharepoint/soap/dws/GetDwsMetaData
X-Office-Version: 11.0.6408
User-Agent: Microsoft Office/11.0 (Windows NT 5.1; Microsoft Office Word 11.0.6408; Pro)
Host: sharepoint.hostelhost.com
Content-Length: 363
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: HELM=Username=&Interface=standard%5FXP&ThemeColour=XP&NonSecureReturnURL=&Password=&LanguageCode=EN
Authorization: NTLM 

<?xml version='1.0' ?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Body>
    <GetDwsMetaData xmlns="http://schemas.microsoft.com/sharepoint/soap/dws/">
      <document>http://sharepoint.hostelhost.com/SharePoint%20Services(1)/Shared%20Documents/SharePoint%20Services.doc</document>
      <id></id>
      <minimal>false</minimal>
    </GetDwsMetaData>
  </s:Body>
</s:Envelope>

Response

HTTP/1.1 200 OK
Date: Tue, 08 Nov 2005 21:26:59 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
MicrosoftSharePointTeamServices: 6.0.2.6411
X-AspNet-Version: 1.1.4322
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=utf-8
Content-Length: 6367

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
  xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <GetDwsMetaDataResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/dws/">
      <GetDwsMetaDataResult>
      <Results>
        <SubscribeUrl>http://sharepoint.hostelhost.com/SharePoint Services(1)/_layouts/1033/SubNew.aspx</SubscribeUrl>
        <MtgInstance />
        <SettingUrl>http://sharepoint.hostelhost.com/SharePoint Services(1)/_layouts/1033/settings.aspx</SettingUrl>
        <PermsUrl>http://sharepoint.hostelhost.com/SharePoint Services(1)/_layouts/1033/EditPrms.aspx</PermsUrl>
        <UserInfoUrl>http://sharepoint.hostelhost.com/SharePoint Services(1)/_layouts/1033/UserEdit.aspx</UserInfoUrl>
        <Roles>
          <Role Name="Reader" Type="Reader" Description="Has read-only access to the Web site." />
          <Role Name="Contributor" Type="Contributor" Description="Can add content to existing document libraries and lists." />
          <Role Name="Web Designer" Type="WebDesigner" Description="Can create lists and document libraries and customize pages in the Web site." />
          <Role Name="Administrator" Type="Administrator" Description="Has full control of the Web site." />
        </Roles>
        <Schema Name="Tasks">
          <Field Name="Title" Type="Text" Required="True"><Choices /></Field>
          <Field Name="Attachments" Type="Attachments" Required="False"><Choices /></Field>
          <Field Name="Order" Type="Number" Required="False"><Choices /></Field>
          <Field Name="Priority" Type="Choice" Required="False"><Choices><Choice>(1) High</Choice><Choice>(2) Normal</Choice><Choice>(3) Low</Choice></Choices></Field>
          <Field Name="Status" Type="Choice" Required="False"><Choices><Choice>Not Started</Choice><Choice>In Progress</Choice><Choice>Completed</Choice><Choice>Deferred</Choice><Choice>Waiting on someone else</Choice></Choices></Field>
          <Field Name="PercentComplete" Type="Number" Required="False"><Choices /></Field>
          <Field Name="AssignedTo" Type="User" Required="False"><Choices /></Field>
          <Field Name="Body" Type="Note" Required="False"><Choices /></Field>
          <Field Name="StartDate" Type="DateTime" Required="False"><Choices /></Field>
          <Field Name="DueDate" Type="DateTime" Required="False"><Choices /></Field>
        </Schema>
        <Schema Name="Documents" Url="Shared Documents">
          <Field Name="FileLeafRef" Type="Invalid" Required="True"><Choices /></Field>
          <Field Name="_SourceUrl" Type="Text" Required="False"><Choices /></Field>
          <Field Name="_SharedFileIndex" Type="Text" Required="False"><Choices /></Field>
          <Field Name="Order" Type="Number" Required="False"><Choices /></Field>
          <Field Name="Title" Type="Text" Required="False"><Choices /></Field>
        </Schema>
        <Schema Name="Links">
          <Field Name="Attachments" Type="Attachments" Required="False"><Choices /></Field>
          <Field Name="Order" Type="Number" Required="False"><Choices /></Field>
          <Field Name="URL" Type="URL" Required="True"><Choices /></Field>
          <Field Name="Comments" Type="Note" Required="False"><Choices /></Field>
        </Schema>
        <ListInfo Name="Tasks">
          <Moderated>False</Moderated>
            <ListPermissions>
              <InsertListItems />
              <EditListItems />
              <DeleteListItems />
              <ManageLists />
            </ListPermissions>
          </ListInfo>
          <ListInfo Name="Documents">
            <Moderated>False</Moderated>
            <ListPermissions>
              <InsertListItems />
              <EditListItems />
              <DeleteListItems />
              <ManageLists />
            </ListPermissions>
          </ListInfo>
          <ListInfo Name="Links">
            <Moderated>False</Moderated>
            <ListPermissions>
              <InsertListItems /><EditListItems /><DeleteListItems /><ManageLists /></ListPermissions>
            </ListInfo>
            <Permissions>
              <ManageSubwebs /><ManageWeb /><ManageRoles /><ManageLists />
              <InsertListItems /><EditListItems /><DeleteListItems />
            </Permissions>
            <HasUniquePerm>True</HasUniquePerm>
            <WorkspaceType>DWS</WorkspaceType>
            <IsADMode>False</IsADMode>
            <DocUrl>http://sharepoint.hostelhost.com/SharePoint%20Services(1)/Shared%20Documents/SharePoint%20Services.doc</DocUrl>
            <Minimal>False</Minimal>
            <Results>
              <Title>SharePoint Services</Title>
              <LastUpdate>632670820194565000</LastUpdate>
              <User>
                <ID>1</ID>
                <Name>C22586_40180administrator</Name>
                <LoginName>C22586_40180administrator</LoginName>
                <Email>andrew@ajohnstone.com</Email>
                <IsDomainGroup>False</IsDomainGroup>
                <IsSiteAdmin>True</IsSiteAdmin>
              </User>
              <Members>
                <Member>
                  <ID>1</ID>
                  <Name>C22586_40180administrator</Name>
                  <LoginName>C22586_40180administrator</LoginName>
                  <Email>andrew@ajohnstone.com</Email>
                  <IsDomainGroup>False</IsDomainGroup>
                </Member>
              </Members>
              <Assignees>
                <Member>
                  <ID>1</ID>
                  <Name>C22586_40180administrator</Name>
                  <LoginName>C22586_40180administrator</LoginName>
                </Member>
              </Assignees>
              <List Name="Tasks">
                <ID>{A9D58464-55C3-477F-A18E-B18A75732A9F}</ID>
              </List>
              <List Name="Documents">
                <ID>{E133F72B-8ECB-436B-8916-CD331678AC75}</ID>
                <z:row ows_FileRef="Shared Documents/SharePoint Services.doc" ows_Title="SharePoint Services" ows_FSObjType="0" ows_Created="2005-11-08T21:26:55Z" ows_Author="1;#C22586_40180administrator" ows_Modified="2005-11-08T21:26:55Z" ows_Editor="1;#C22586_40180administrator" ows_ID="1" ows_ProgID="" xmlns:z="#RowsetSchema" />
              </List>
              <List Name="Links"><ID>{51BF4716-E5B7-4C0D-A6AE-93EF0645FF38}</ID></List>
            </Results>
          </Results>
      </GetDwsMetaDataResult>
    </GetDwsMetaDataResponse>
  </soap:Body>
</soap:Envelope>

I’ll post an example up when I get some free time…

Share

Comment Form

About this blog

Andrew Johnstone is a software engineer / lead developer working at Everlution Software.

Photostream

  • Multiple Ucarp on the same host | PaoloBertasi: […] http://ajohnstone.com/achives/running-several-vips-on-the-same-interface-with-ucarp-and-ha [...]
  • mohit: I am working the same on windows server 2008 and mysql version 5.1.39 ,but it is not working and i a [...]
  • Steve: Hi there... sorry that this is old, but I'm trying to use your script to check for my usage per seco [...]
  • vinodh: great. thanks . My boss wanted me to configure multiple mysql instances on same physical machine . i [...]
  • andrew.johnstone: In the example above this was in fact using spl_autoload_register. I've never debugged this properly [...]

GitHub

GitHub Octocat

ajohnstone @ GitHub

  • Status updating...