glenc / sp.py

A Python library for working with the SharePoint object model

This URL has Read+Write access

sp.py / README
100644 39 lines (26 sloc) 1.066 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
This library provides the ability to automate various
SharePoint activities through easy to read and modify Python
scripts.
 
The core library is located in the sp module. The scripts
module contains a number of scripts for performing specific
activities such as backing up sites.
 
USAGE
 
# Working with the sp module.
 
import sp
from sp import *
 
# enumerate all sites and print out the url
sp.enum_sites("http://myserver", lambda s: print s.Url)
 
# apply a master page to all webs
def apply_theme(web):
web.MasterUrl = "http://myserver/custom.master"
web.Update()
 
sp.enum_all_webs("http://myserver", apply_theme)
 
 
# Calling scripts in the scripts module
 
> cd sp.py
> ipy backupsites.py --url http://myserver --destination c:\backups --overwrite
>
> ipy setprofileprop.py --url http://myserver --property Picture --value http://myserver/pics/{Alias}.jpg
>
 
REQUIREMENTS
 
This library is designed to work with Iron Python 1.1.1. You
can download Iron Python from http://www.codeplex.com/IronPython.