开发学院软件开发Python python操作sharepoint对象模型 阅读

python操作sharepoint对象模型

 2010-09-22 11:27:22 来源:WEB开发网   
核心提示: PyWebusing System;using System.Collections.Generic;using System.Text;using Microsoft.SharePoint;using System.Runtime.InteropServices;namespace Py

PyWeb

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
using System.Runtime.InteropServices;

namespace PySP
{
    [ComVisible(true)]
    public class PyWeb
    {
        protected SPWeb web = null;

        protected void EnsureWeb()
        {
            if (this.web == null)
                throw new NullReferenceException("the web object can't be null!");
        }

        public PyWeb() { }

        public PyWeb(SPSite site, string url)
        {
            this.web = site.OpenWeb(url);
        }

      
        public bool AllowAnonymousAccess
        {
            get
            {
                EnsureWeb();
                return this.web.AllowAnonymousAccess;
            }

        }

       

        public bool AllowRssFeeds
        {
            get
            {
                EnsureWeb();
                return this.web.AllowRssFeeds;
            }

        }

        public bool AllowUnsafeUpdates
        {
            get
            {
                EnsureWeb();
                return this.web.AllowUnsafeUpdates;
            }
            set
            {
                EnsureWeb();
                this.web.AllowUnsafeUpdates = value;
            }
        }


        public string Title
        {
            get
            {
                EnsureWeb();
                return this.web.Title;
            }
            set
            {
                EnsureWeb();
                this.web.Title = value;
            }
        }

        public string Description
        {
            get
            {
                EnsureWeb();
                return this.web.Description;
            }
            set
            {
                EnsureWeb();
                this.web.Description = value;
            }
        }

        public string Name
        {
            get
            {
                EnsureWeb();
                return this.web.Name; 
            }
            set
            {
                EnsureWeb();
                this.web.Name = value;
            }
        }
        

        public uint Language
        {
            get
            {
                EnsureWeb();
                return this.web.Language; 
            }
        }

        public void Update()
        {
            EnsureWeb();
            this.web.Update();
        }

        public void Delete()
        {
            EnsureWeb();
            this.web.Delete(); 
        }

        public void Close()
        {
            if (this.web != null)
            {
                this.web.Dispose();
                this.web = null;
            }
        }

        public PyListCollection Lists
        {
            get
            {
                EnsureWeb();
                return new PyListCollection(this.web.Lists);
            }
        }

    }
}

上一页  1 2 3 4 5 6 7  下一页

Tags:python 操作 sharepoint

编辑录入:爽爽 [复制链接] [打 印]
[]
  • 好
  • 好的评价 如果觉得好,就请您
      0%(0)
  • 差
  • 差的评价 如果觉得差,就请您
      0%(0)
赞助商链接