SharePoint UserControl
摘要:SharePoint User Control 的开发有多种,现在主要介绍其中的两种。1.所有的代码都写在后辍名为ascx的文件中,如下图。 其优点为是容易更新到SharePoint网站, 不需要dll 编辑; 缺点:容易代码出错,没有智能检验,不可以跟踪代码:<%@ Control Language="C#" AutoEventWireup="true" ClassName="PosterscopeTopNavigation2" %><%@ Import Namespace="System.Data&qu
阅读全文
posted @
2011-11-07 09:36
gzh4455
阅读(624)
推荐(0)
工具类:Log
摘要:public static string LogPath { get { string path = string.Empty; path = Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFiles) + @"\Microsoft Shared\web server extensions\12\LOGS\"; ...
阅读全文
posted @
2011-11-04 10:58
gzh4455
阅读(210)
推荐(0)
SPSiteDataQuery and SPQuery
摘要:SPSiteDataQuery 格式,其实下面的是很不规范的,只是让自己了解其真正的格式。以后会弄一个类来做这方面的工作<MatchingQuery> <Lists><List ID="2DF16909-AEE4-44F0-BBF5-B6E5F33F7AD6" /></Lists> <Webs Scope="SiteCollection" /> <Query> <OrderBy><FieldRef Name='ID'/></OrderBy
阅读全文
posted @
2011-11-03 15:47
gzh4455
阅读(978)
推荐(0)
SPSite, SPWeb Dispose and Class Design Partter
摘要:Need to Dispose:1. SPSite oSPsite = new SPSite(http://server)2. siteCollection = new SPSite(SPContext.Current.Web.Url))3. SPSite siteCollection = siteCollections.Add("sites/myNewSiteCollection", "DOMAIN\\User", roger.lamb@litwareinc.com)4. using (SPWeb web = new SPSite(SPContext.
阅读全文
posted @
2011-11-02 16:52
gzh4455
阅读(339)
推荐(0)
Add Properties or Delete List Folder Content Type
摘要:private void button1_Click(object sender, EventArgs e) { string webURL = "http://richsharepoint:90/ApplicationManagement"; SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite site =new SPSite (webURL)) { ...
阅读全文
posted @
2011-11-01 12:00
gzh4455
阅读(373)
推荐(0)
异步Web Part
摘要:代码如下:Calling Web Serviceusing System;using System.Runtime.InteropServices;using System.Web.UI;namespace WebPartCollection{ [Guid("d2b37a6c-650c-4ef4-962c-85297f15b0b5")] public class AsyWebServiceWebPart : System.Web.UI.WebControls.WebParts.WebPart, ICallbackEventHandler { public Asy...
阅读全文
posted @
2011-10-04 22:16
gzh4455
阅读(209)
推荐(0)
WebPart常用代码
摘要:1. 判断模式:设计模式Design Model protected override void Render(HtmlTextWriter writer) { bool isDesign = this.WebPartManager != null && this.WebPartManager.DisplayMode != WebPartManager.BrowseDisplayMode; if (isDesign) { writer.Write("<div style=...
阅读全文
posted @
2011-10-04 15:58
gzh4455
阅读(354)
推荐(0)
WebPart Complex Property
摘要:下面代码是实现一个Dropdown,同时实现其同步变化。代码如下:Complex Propertyusing System;using System.Runtime.InteropServices;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.ComponentModel;using System.Collections;namespace WebPartCollection{ [Guid("cf18e6af-3ab5-
阅读全文
posted @
2011-10-04 15:48
gzh4455
阅读(261)
推荐(0)
Create List
摘要:1. Create ListView Code public static bool CreateList(SPWeb web,string listName,string strDescription,SPListTemplateType type,bool IsOnQuickLaunch) { bool result = false; try { web.AllowUnsafeUpdates = true; Guid newListId...
阅读全文
posted @
2011-10-04 14:56
gzh4455
阅读(276)
推荐(0)
WebPart引用UserControl
摘要:Webpart引用UserControl有两种方法:1. 引用QuickPart2. 自己开发出一个WebPart暴露一个引用地址属性。代码如下:View Code using System;using System.Runtime.InteropServices;using System.Web.UI;using System.Web.UI.WebControls.WebParts;namespace WebPartCollection{ [Guid("1c7e7f5f-c4d6-4628-8785-3804bc0f5c85")] public class UserCon
阅读全文
posted @
2011-10-04 14:23
gzh4455
阅读(283)
推荐(0)
Multi-Language WebPart简单引用
摘要:WebPart多语言的实现:WPResource.csView Code using System;using System.Web.UI.WebControls.WebParts;using Microsoft.SharePoint;using System.ComponentModel;using System.Web;namespace WebPartCollection.Common{ public static class WPResource { const string RESOURCE_FILE_NAME = "Anson"; /// ...
阅读全文
posted @
2011-10-04 14:03
gzh4455
阅读(382)
推荐(1)
Email字段开发及部署
摘要:这个实例主要是建义一书中的开发实例!字段类型由3部分组成:继承于SPField的字段类,继承于BaseRenderControl的字段呈现控件类和字段的的配置文件。下面是这个项目的结构:EmailFieldControls.csView Code using System;using System.Collections.Generic;using System.Linq;using System.Text;using Microsoft.SharePoint;using Microsoft.SharePoint.WebControls;using System.Web;using Syste
阅读全文
posted @
2011-10-02 16:41
gzh4455
阅读(357)
推荐(0)
Distribute Permission Instance (EventHandler)
摘要:SharePoint的EventHandler主要有Web Level,List Level,List Item Level,Email几种。SharePoint的event handler主要是继承SPWebEventReceiver, SPEmailEventReceiver, SPListEventReceiver和SPItemEventReceiver类去实现其中相应的方法来完成我们的需求。ModifiedPermissions:using System;using System.Collections.Generic;using System.Text;using Microsoft
阅读全文
posted @
2011-09-29 10:33
gzh4455
阅读(332)
推荐(0)
WebPart管理和打开页面设计模式
摘要:Webpart出错,无法打开页面,contents=1 ,会转到webpart管理页面,把出问题的删掉在URL后面加入“?&toolpaneview=2”打开设计页或者加“DisplayMode=Design”
阅读全文
posted @
2011-09-27 22:57
gzh4455
阅读(176)
推荐(0)