Jump to content

Recommended Posts

Posted (edited)

Hi,

based on the jquery-plugin spservices.codeplex.com I created an UDF to access the SOAP-Webservices of Sharepoint 2007/2010.

As of now it should cover all Webservices and should be working with 2007 and 2010.

Currently I have not much time to create a good documentation and example-scripts but nevertheless I wanted to share it with you.

Example of retrieving the content of a list

#include "sharepoint.au3"
#include <_xmldomwrapper.au3>

Global $sWebUrl = 'http://url.of.sharepoint.site'
Global $sStatusList = 'Status'
Global $oStatus = ObjCreate('Scripting.Dictionary')

$oStatus = _GetStatus()
MsgBox(0, 'Sharepoint-Test', 'Number of Records: ' & $oStatus.Item(0))

For $i = 1 to $oStatus.Item(0)
MsgBox(0, 'Sharepoint-Test', 'Content of Title-Field in Record: ' & $i & ' - ' & $oStatus.Item($i).Item('ows_Title'))
Next

Func _GetStatus()
Local $oOptions

$oOptions = ObjCreate('Scripting.Dictionary')
$oOptions.Add('webURL', $sWebUrl)
$oOptions.Add('operation', 'GetListItems')
$oOptions.Add('CAMLQuery', "")
$oOptions.Add('listName', $sStatusList)
$oOptions.Add('CAMLViewFields', '')
$oOptions.Add('completefunc', '__PrepareStatus')
Return _SPServices($oOptions)
EndFunc


Func __PrepareStatus($sOrig)
Local $oRows
Local $oRow
Local $iCount
Local $aNames[1]
Local $aValues[1]
Local $sName
Local $sValue
Local $i
Local $j

$sOrig = _SPTransformOutput($sOrig)
_XMLLoadXML($sOrig)
$iCount = _XMLGetAttrib('/GetListItemsResponse/GetListItemsResult/listitems/data', 'ItemCount')
$oRows = ObjCreate('Scripting.Dictionary')
$oRows.Add(0, $iCount)

If 0 < $iCount Then

For $i = 0 To ($iCount - 1)
$oRow = ObjCreate('Scripting.Dictionary')
_XMLGetAllAttribIndex('/GetListItemsResponse/GetListItemsResult/listitems/data/row', $aNames, $aValues, '', $i)

For $j = 0 To UBound($aNames) - 1
$sName = $aNames[$j]
$sValue = $aValues[$j]
$oRow.Add($sName, $sValue)
Next

$oRows.Add($i + 1, $oRow)
Next

EndIf

Return $oRows
EndFunc

I hope it is useful for someone and please be patient if you have questions. I'll try to answer as fast as possible

Joerg

sharepoint.au3

Edited by schoppet
  • 2 months later...
Posted

@schoppet

How could I have missed this one ! :>

This is freaking awsome !

Big library and quite complete as well.

But without documentation it takes a while to get started.

Could you poste an example how to upload a document to a library incl. meta data ?

Thanks for sharing !

Rgds

ptrex

  • 4 months later...
Posted

Hi schoppet,

can you give me an example who to change an item using your sharepoint.udf?

For example I have a list with 2 colums (Name, Status). I now want to change the Status of the first list element to "tested". How can I do that? Can you post an example script?

Thanks a lot :-)

  • Moderators
Posted

Yoshio,

schoppet has not been back here since he posted the above so I am not sure you will get a response any time soon. :(

But you might find him on the German forum (http://www.autoit.de) - and looking at your e-mail the change of language should not be a problem. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...