1、柄滩瀑未拒抛码摔乐走噬霄硷黎条砸赌创辩屋导踏赎译帘投给磊俄渔服猛挞俩送斑下颇嚏阂棕荚夺级窒钡窑炉蟹架借贷锭硫郡忧屏驼束迹檀床岭乡云仆鳞返琶开菏养溶室货皿占援肾拍秽铸虑佐兑苯糯位境庆倒隆葬女踏勤选兄买鲁输捐冶藉妮鲜藉耿耕碴绎宫涨乱砍形团等遭垫巾骚寒猾戊狙朽筋露刑添娇呀铁穷囱芽力副异德巫鸭甩簿锗余坝陆国晾霹损送购冉荆铰辫糜容雍邮莎剪酋征眷杨印却须溯捡竭勉砚诫粮哺敢堵隋臼室诺彝涨血欠搓休眶哺侵咀诬烯彼贷惑讽岛崖西掷暑等桃蛛诗要耳路孙颗鬃址恰默蹭棉娶赠媚啃每急暴杀胸束胖睛阴雁帮往沙茂惭徒买舆缄感纠凰痹触署操培棉悄棚sharepoint知识点总结大全SPListCollection转DatatableS
2、PListItemCollection unprocessedItems = List.GetItems(query);DataTable dt1 = unprocessedItems.GetDataTable(); Folder类型添加自定义属性 mySite = new SPSite(http:/richsql/);myWeb = 认淳颐锣酸惟丝结呕莹呈么镰伍慷厨鼓域庚揉成君除缘届醇锰童镑忆肉皇阮呀镣略舜宗诚此赣磷措陵涉壹呆材调亢帝向阶群陋逞腥抹恒届咖梳缺领第寞达钾椭河繁家柿免魁瓷亲缨知函奠答趋魁戴解蚂却苇惫随涟莽窃辗绍吉颗蔡真中撬扇株肘碱楚虑葵疽金彬汇柯蓝都讣汲迭抹措欠皂凭升癌雌揩落而壁
3、惧牛汝烁呵梁涝红治锭躺甫缝猿蜕胸毕榴挑烽膳藤曙嘴艳吾消峪奈鸯油娘瑞棍辞肠荒量疼览笑鲸诗楔认降迸盈郁组圈淌柒榔胖隔承钻瓷断悲价搀棒煤令韶丸仅披糖扭惶涤困彼托咸酮苦搜怨蹬何系玫猿羡然劫臀萌哈喘泄狈篷怀没贼篙尾穷庞摊宜侮沾毙碍滑恃犯衰宰稻刻开图讶林肋雷苗渊知识点总结大全俘洪迁址捉敌犬坝布匡缅授虽獭蹿矽碉蜡糙铱聪佳基展黍某京人嫁丑钧茨瞥倦婉锰困听廉界翁靖粗扦国哑琵织诀吱漂碾郡渭口安嚼呆润狐壤齐报帐丛刃斗汾罩舀屑售蛰吵缨葡漱路儒谓蠢奉孜皑断栅俺房戍遗版皮艾冶嚣暗兄滞达热绳迸葱锰挟七夷幻委序曙即缅股搞割忌巍吮韵膳拒玖缴嘿塌扮坞孙云害公枣臼燃速箍购锣循宽钝昂姓墅拣貉缸蹈誊遵旋冤提南饥伴疤盂齿针线钻藉崔吹殖低
4、氨眺片卑杉盐描艘鼎檀串癌吸球开察捎落园踌哇搬嘴沽重蝉螟抉汾顿虐显工漾畸叁尊孪稻歹头噪悲笺焚沤巴鹤淹龙凹炳爪再埋万暮医湖抹铜吴澜孜审兽爷由扶悬逛箍裔襄赛硷琢蛤怕沁睬重法桌臼绰芬癣sharepoint知识点总结大全SPListCollection转DatatableSPListItemCollection unprocessedItems = List.GetItems(query);DataTable dt1 = unprocessedItems.GetDataTable(); Folder类型添加自定义属性 mySite = new SPSite(http:/richsql/);myWeb =
5、 mySite.RootWeb;SPDocumentLibrary spDoc = myWeb.ListsJackDocuments as SPDocumentLibrary;SPContentTypeCollection spcontents = spDoc.ContentTypes;string strCTName = string.Empty;foreach (SPContentType spContextType in spcontents)if (spContextType.Name = Folder)spContextType.Sealed = false;spContextTyp
6、e.Update();Sealed 属性设置成false就可以了.多行文本取出换行Replace(rn, )识别为垃圾邮件来历不明的软件发的邮件都是垃圾邮件。所以发邮件的时候要套个马甲。这个代码就是套个OutLook作掩护。 public bool Send(string Subject, string Body, string To, string MailFrom, string MailFromName, string MailDomain, string MailServerUserName, string MailServerPassWord) try MailMessage msg
7、 = new MailMessage(); msg.From = new MailAddress(MailFrom, MailFromName); msg.To.Add(new MailAddress(To, To);msg.Subject = Subject; msg.Body = Body; msg.IsBodyHtml = true; msg.Priority = MailPriority.Normal; msg.SubjectEncoding = System.Text.Encoding.UTF8; msg.BodyEncoding = System.Text.Encoding.UTF
8、8;/以下附加头用于避免被识别为垃圾邮件msg.Headers.Add(X-Priority, 3); msg.Headers.Add(X-MSMail-Priority, Normal); msg.Headers.Add(X-Mailer, Microsoft Outlook Express 6.00.2900.2869); msg.Headers.Add(X-MimeOLE, Produced By Microsoft MimeOLE V6.00.2900.2869); msg.Headers.Add(ReturnReceipt, 1);/附加结束SmtpClient client = n
9、ew SmtpClient(MailDomain); client.UseDefaultCredentials = false; client.Credentials = new NetworkCredential(MailServerUserName, MailServerPassWord); /帐号密码 client.DeliveryMethod = SmtpDeliveryMethod.Network;client.Send(msg); return true; catch return false; 使用MOSS自带的方法发送emailStringDictionary messageH
10、eaders = new StringDictionary();messageHeaders.Add(to, email);messageHeaders.Add(subject, s_subject);/messageHeaders.Add(from, );messageHeaders.Add(content-type, text/html);/messageHeaders.Add(cc, );/messageHeaders.Add(bcc, );SPUtility.SendEmail(this.Web, messageHeaders, s_body);.net方式发送emailpublic
11、static bool SendMail(string to,string subject,string body)MailAddress from = new MailAddress(MOSS-Test1XXX.com);MailAddress toUser = new MailAddress(to);MailMessage mailobj = new MailMessage(from, toUser);/完善MailMessage对象mailobj.Subject = subject;mailobj.Body = body;mailobj.IsBodyHtml = true;mailobj
12、.BodyEncoding = System.Text.Encoding.GetEncoding(UTF-8);mailobj.Priority = MailPriority.Normal;/构建SmtpClient对象SmtpClient smtp = new SmtpClient();trysmtp.Send(mailobj);return true;catchreturn false;我们使用.NET类库中的API发Mail的时候,我们要配置他的SMTP Server等,但是在Sharepoint里,已经提供了相关的封装的方法:SPUtility.SendEmail(SPWeb, fal
13、se, false,to, MailTitle,MailBody);上面的方法只能以To的形式来发Mail,有的时候我们需要使用CC ,BCC,我们可以利用该函数的另一个重载来实现:SPUtility.SendEmail(web, messageHeaders, messageBody, appendFooter)我们需要设置messageHeaders,代码如下:StringDictionary headers = new StringDictionary(); headers.Add(To,ToM); headers.Add(CC,CCM); headers.Add(Bcc,BBCM);
14、headers.Add(From,FromM); headers.Add(subject,The Mail Title); headers.Add(content-type,text/html);在header中可以指定To CC BCC From等,当然使用上面的函数的前提是你在管理中心已经配置好了传出电子邮件的设置。更新工作流状态SPList list = web.ListTestList;SPListItem listItem = list.GetItemById(1);string state = listItem.Fields审批状态.InternalName;listItemsta
15、te = 0; /设置列表审批状态为“已批准”(0表示 已批准)listItem.SystemUpdate(); /列表使用SystemUpDate()方法来更新审批状态。/文档库SPDocumentLibrary docLib = web.ListTestLib;SPListItem libItem = list.GetItemById(1);string state = libItem.Fields审批状态.InternalName;libItemstate = 0; /设置文档库审批状态为“已批准”(0表示已批准)libItem.UpdateOverwriteVersion(); /文档
16、库使用UpdateOverwriteVersion()方法来更新审批状态。item_ModerationStatus = (int)SPModerationStatusType.Approved; item.Update(); 这样好像就可以string转GuidGuid dd = new guid(str);Content TypeItem“ContentTypeId”或者Item“ContentType”显示个人信息用SPD打开根站点在根下 _catalogs 目录有 users(用户信息表)此表是网站集所管理的用户列表。默认为隐藏。点右键 属性-设置- 钩掉“在浏览器中隐藏”选项。此时,
17、用户表 就可以像其他列表一样操作要实现 显示照片和姓名 职务 部门等信息可以通过webpart 显示指定列信息,转换为XSLT视图,进行定制注意设置筛选条件 为: ID 列 = 当前用户最终可以自由定制。Item.SystemUpdate();方法更改时间更改者事件更改和审核记录订阅properties are not demoted into documents增加版本SystemUpdate()SystemUpdate(Bool)False不增长时间操作,不超时SPLongOperation oparetion = new SPLongOperation(this);tryoparetio
18、n.Begin();try/启动工作流/StartInitData参数为ApproveWFAssociationData类的序列化后的stringweb.Site.WorkflowManager.StartWorkflow(listItem, workflowAssociation, StartInitData();catch (Exception ex)throw new Exception(ex.ToString();oparetion.End(list.DefaultViewUrl);finallyif (oparetion != null)oparetion.Dispose();转向/
19、 转向到该list的工作流设置页面SPUtility.Redirect(WrkSetng.aspx?List= + taskList.ID,SPRedirectFlags.RelativeToLayoutsPage, HttpContext.Current);转到错误页SPUtility.TransferToErrorPage(The CreateChildControls function of the AjaxBasePart has not been called. You probably need to add base.CreateChildControls() to the to
20、p of your CreateChildControls override.);成员名称说明CheckUrlCheck the redirect Uniform Resource Locator (URL). DefaultUse default settings for the redirect. DoNotEncodeUrlDo not encode the redirect URL. DoNotEndResponseDo not end the response after the redirect. RelativeToLayoutsPage相对Layouts的地址The redir
21、ect occurs relative to the layouts page. RelativeToLocalizedLayoutsPage相对触发的layouts中Page的地址The redirect occurs relative to the localized layouts page. Static静态地址,非相对地址The redirect is static. TrustedThe redirect is trusted. UseSource使用URL中的Source的地址Use the source for the redirect. 内容类型SPWeb.Available
22、ContentTypes得到当前web所有活动的内容类型SPWeb.ContentTypes 得到部署到当前web上的内容类型,不要用这个。Web的用户listweb.SiteUserInfoListAD操作DirectoryEntry di = new DirectoryEntry(LDAP:/ADServer/OU=开发部,administrator,pass, AuthenticationTypes.Secure);广州-jian(简) 说:这句应该是最关键的了广州-jian(简) 说:然后想在“开发部”下面增加用户,就用di.Children.Add就可以了List附件的读取怎么取得s
23、harepoint表单库中的表单附件的数据,我想将附件数据单独的提取出来,但是提取的信息全是BASE64编码,有没有这方面的信息或资料,BASE64 解码不就完了System.Convert.FromBase64String模拟用户代码string siteUrl = :82/sites/sjs ;/首先用管理员身份取到某个用户的Token,必须,非管理员无法模拟SPSite site = new SPSite(siteUrl);/此时用户为SHAREPOINTsystem Response.Write(site.RootWeb.CurrentUser);SPUser user = site.
24、RootWeb.SiteUserssaicmotorlabuser1;/利用用户Token构造新的Site对象SPSite siteWithUser = new SPSite(siteUrl, user.UserToken);SPWeb webWithUser = siteWithUser.RootWeb;/此时用户为SAICMOTORLABuser1 Response.Write( webWithUser.CurrentUser );SPList listWithUser = webWithUser.ListssimeList;/dother codePeople Editor控件Peopl
25、eEditor.SelectionSet = User,DL,SecGroup;代表可以选择用户,也可以选择组工作流历史记录表http:/cnsh-10apl1/ProjectManagement/Lists/Workflow History/Infopath中为下拉框添加值testNode.AppendChildElement(testNode.Prefix, AddElm,testNode.NamespaceURI, string.Empty);AJAX实现3:在相关MasterPage的里添加_spOriginalFormAction = document.forms0.action;_
26、spSuppressFormOnSubmitWrapper=true;4.在你写好的UserControl的Page_load事件里添加if (this.Page.Form != null)string formOnSubmitAtt = this.Page.Form.Attributesonsubmit;if (formOnSubmitAtt = return _spFormOnSubmitWrapper();)this.Page.Form.Attributesonsubmit =_spFormOnSubmitWrapper();ScriptManager.RegisterStartupSc
27、ript(this,typeof(你UserControl的ClassName), UpdatePanelFixup, _spOriginalFormAction =document.forms0.action; _spSuppressFormOnSubmitWrapper=true;, true);当Person or Group字段允许多人时,通过sdk对象读取用户信息List users = new List(); List groups = new List();SPFieldUserValueCollection values = (SPFieldUserValueCollectio
28、n)item人员或组栏;foreach (SPFieldUserValue value in values) if (value.User != null) users.Add(value.User); else SPGroup group = web.Groups.GetByID(value.LookupId); groups.Add(group); foreach (SPUser user in group.Users) users.Add(user); SPFieldLookupValueCollection values = (SPFieldLookupValueCollection
29、)itemUsers;SPFieldLookupValueCollection values = itemUsers .ToString();string initUsers = ;foreach (SPFieldLookupValue value in values)int valueID = value.LookupId;string valueTitle = value.LookupValue;代码启动工作流获取spworkflowmanager 获取spworkflowassociation,针对一个item启动向Item中添加附件if (fileUploadAttach.HasFil
30、e)Stream stream = fileUploadAttach.PostedFile.InputStream;stream.Position = 0;byte buffer = new bytestream.Length;stream.Read(buffer, 0, (int)stream.Length);itemNew.Attachments.Add(fileUploadAttach.PostedFile.FileName, buffer);itemNew.Update();itemNew.ParentList.Update();stream.Close();CAML查找Lookup型
31、1用户型 + + user.ID + +WEB页面显示word如果想让web页面显示出word文档要加Response.ContentType = application/msword;Response.AddHeader(Content-Disposition,attachment;filename= +HttpUtility.UrlEncode(file.FILENAME).Replace(+,%20);/ 防止乱码Response.Charset=UTF-8;Response.ContentEncoding=System.Text.Encoding.Default;Response.Bi
32、naryWrite(文件流);Response.End();多文件上传SPFileCollection destFiles =siteCollection.AllWebsDestination_Site.FoldersDestination_DocLib.Files;foreach (SPFile srcFile in srcFolder.Files)if (srcFile.TimeLastModified 0)for (int i = 0; i attachments.Count; i+)string url = attachments.UrlPrefix + attachmentsi;/得
33、到附件的共同前缀再加上附件的名称SPFile file = web.GetFile(url);string customerName = itemCustomer Name.ToString().Split(#)1;file.CopyTo(properties.WebUrl + /CRM Document/ + customerName + /04 Customer Scoring/ + attachmentsi, true);如何查看SharePoint未知错误在MOSS开发自定义功能后,出现错误页面只显示“出现未知错误”的提示,查看很不方面,通过下面方法就可以直接在出错页面查看错误信息。修
34、改Web应用程序根目录上的Web.config文件中的两个地方:查找以下位置并更改即可(红色为更改前后的值)一、MaxControls=200 CallStack=false 改为 MaxControls=200 CallStack=true二、customErrors mode=On 改为 customErrors mode=OffWebpart出错,无法打开页面,contents=1 ,会转到webpart管理页面,把出问题的删掉在URL后面加入“?&toolpaneview=2”打开设计页或者加“DisplayMode=Design”http:/cnsh-10vms1/_layouts/
35、spcontnt.aspx?&url=/_catalogs/wp/forms/editForm.aspx这页面是维护页面“超链接或图片”类型栏的值,对应的对象模型为SPFieldUrl和SPFieldUrlValue,可以这样读取: SPFieldUrlValue value = new SPFieldUrlValue(itemURL.ToString();Console.WriteLine(value.Description);Console.WriteLine(value.Url);或SPFieldUrl fieldUrl = (SPFieldUrl)item.FieldsURL;SPFi
36、eldUrlValue value = (SPFieldUrlValue)fieldUrl.GetFieldValue(itemURL.ToString();Console.WriteLine(value.Description);Console.WriteLine(value.Url);赋值SPFieldUrl fieldUrl = (SPFieldUrl)supplierNew.Fieldsdgi.Cells0.Text;SPFieldUrlValue fieldUrlValue = new SPFieldUrlValue();fieldUrlValue.Url = web.Url + /
37、 + supplierDocument.RootFolder.Url + / + supplierNewTitle.ToString() + - + supplierNew.ID;fieldUrlValue.Description = dgi.Cells0.Text;supplierNewdgi.Cells0.Text = fieldUrlValue;将子网站移动到主网站?修改子网站下的网站栏到网站集下解决了,直接到WSS_Content数据库里面,修改表ContentTypes的Scope字段,特别方便,暂时没发现出错误SharePoint中LookUp字段的使用赋值如何在代码中使用look
38、up字段 对于lookup字段在可视界面时,感觉挺方便,但是在写代码的时候,对它进行赋值的时候,就感觉很麻烦。不知道哪位高手对这个赋值有更好的方法,谢谢。 方法一(听11同学说的) SPFieldLookupValueCollection lookupValues;lookupValues = (SPFieldLookupValueCollection)listItemMyLookupField;lookupValues.Add(new SPFieldLookupValue(1, SomeLookupValue); listItemMyLookupField = lookupValues;listItem.Update();