知识点总结大全.docx
- 文档编号:16872581
- 上传时间:2023-07-19
- 格式:DOCX
- 页数:22
- 大小:23.66KB
知识点总结大全.docx
《知识点总结大全.docx》由会员分享,可在线阅读,更多相关《知识点总结大全.docx(22页珍藏版)》请在冰点文库上搜索。
知识点总结大全
sharepoint知识点总结大全
SPListCollection转Datatable
SPListItemCollectionunprocessedItems=List.GetItems(query);
DataTabledt1=unprocessedItems.GetDataTable();
Folder类型添加自定义属性
mySite=newSPSite("http:
//richsql/");
myWeb=mySite.RootWeb;
SPDocumentLibraryspDoc=myWeb.Lists["JackDocuments"]asSPDocumentLibrary;
SPContentTypeCollectionspcontents=spDoc.ContentTypes;
stringstrCTName=string.Empty;
foreach(SPContentTypespContextTypeinspcontents)
{
if(spContextType.Name=="Folder")
{
spContextType.Sealed=false;
spContextType.Update();
}
}
Sealed属性设立成false就可以了.
多行文本取出换行
Replace(""r"n","
")
辨以为垃圾邮件
来历不明软件发邮件都是垃圾邮件。
因此发邮件时候要套个马甲。
这个代码就是套个OutLook作掩护。
publicboolSend(stringSubject,stringBody,stringTo,stringMailFrom,stringMailFromName,stringMailDomain,stringMailServerUserName,stringMailServerPassWord)
{
try
{
MailMessagemsg=newMailMessage();
msg.From=newMailAddress(MailFrom,MailFromName);
msg.To.Add(newMailAddress(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.UTF8;
//如下附加头用于避免被辨以为垃圾邮件
msg.Headers.Add("X-Priority","3");
msg.Headers.Add("X-MSMail-Priority","Normal");
msg.Headers.Add("X-Mailer","MicrosoftOutlookExpress6.00.2900.2869");
msg.Headers.Add("X-MimeOLE","ProducedByMicrosoftMimeOLEV6.00.2900.2869");
msg.Headers.Add("ReturnReceipt","1");
//附加结束
SmtpClientclient=newSmtpClient(MailDomain);
client.UseDefaultCredentials=false;
client.Credentials=newNetworkCredential(MailServerUserName,MailServerPassWord);//帐号密码
client.DeliveryMethod=SmtpDeliveryMethod.Network;
client.Send(msg);
returntrue;
}
catch{returnfalse;}
}
使用MOSS自带办法发送email
StringDictionarymessageHeaders=newStringDictionary();
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方式发送email
publicstaticboolSendMail(stringto,stringsubject,stringbody)
{
MailAddressfrom=newMailAddress("");
MailAddresstoUser=newMailAddress(to);
MailMessagemailobj=newMailMessage(from,toUser);
//完善MailMessage对象
mailobj.Subject=subject;
mailobj.Body=body;
mailobj.IsBodyHtml=true;
mailobj.BodyEncoding=System.Text.Encoding.GetEncoding("UTF-8");
mailobj.Priority=MailPriority.Normal;
//构建SmtpClient对象
SmtpClientsmtp=newSmtpClient("");
try
{
smtp.Send(mailobj);
returntrue;
}
catch
{
returnfalse;
}
}
咱们使用.NET类库中API发Mail时候,咱们要配备她SMTPServer等,但是在Sharepoint里,已经提供了有关封装办法:
SPUtility.SendEmail(SPWeb,false,false,"","MailTitle","MailBody");
上面办法只能以To形式来发Mail,有时候咱们需要使用CC,BCC,咱们可以运用该函数另一种重载来实现:
SPUtility.SendEmail(web,messageHeaders,messageBody,appendFooter)
咱们需要设立messageHeaders,代码如下:
StringDictionaryheaders=newStringDictionary();
headers.Add("To","");
headers.Add("CC","");
headers.Add("Bcc","");
headers.Add("From","");
headers.Add("subject","TheMailTitle");
headers.Add("content-type","text/html");
在header中可以指定ToCCBCCFrom等,固然使用上面函数前提是你在管理中心已经配备好了传出电子邮件设立。
更新工作流状态
SPListlist=web.List["TestList"];
SPListItemlistItem=list.GetItemById
(1);
stringstate=listItem.Fields["审批状态"].InternalName;
listItem[state]=0;//设立列表审批状态为“已批准”(0表达已批准)
listItem.SystemUpdate();//列表使用SystemUpDate()办法来更新审批状态。
//文档库
SPDocumentLibrarydocLib=web.List["TestLib"];
SPListItemlibItem=list.GetItemById
(1);
stringstate=libItem.Fields["审批状态"].InternalName;
libItem[state]=0;//设立文档库审批状态为“已批准”(0表达已批准)
libItem.UpdateOverwriteVersion();//文档库使用UpdateOverwriteVersion()办法来更新审批状态。
item["_ModerationStatus"]=(int)SPModerationStatusType.Approved;
item.Update();
这样好像就可以
string转Guid
Guiddd=newguid(str);
ContentType
Item[“ContentTypeId”]或者Item[“ContentType”]
显示个人信息
用SPD打开根站点
在根下_catalogs目录有users(顾客信息表)
此表是网站集所管理顾客列表。
默以为隐藏。
点右键属性--设立--钩掉“在浏览器中隐藏”选项。
此时,顾客表就可以像其她列表同样操作
要实现显示照片和姓名职务部门等信息
可以通过webpart显示指定列信息,转换为XSLT视图,进行定制
注意设立筛选条件为:
ID列=[当前顾客]
最后可以自由定制。
Item.SystemUpdate();
办法
更改时间
更改者
事件
更改和审核记录
订阅
propertiesarenotdemotedintodocuments
增长版本
SystemUpdate()
×
×
√
√
×
×
×
SystemUpdate(Bool)
×
×
√
√
×
×
False不增
长时间操作,不超时
SPLongOperationoparetion=newSPLongOperation(this);
try
{
oparetion.Begin();
try
{
//启动工作流
//StartInitData参数为ApproveWFAssociationData类序列化后string
web.Site.WorkflowManager.StartWorkflow(listItem,workflowAssociation,StartInitData());
}
catch(Exceptionex)
{
thrownewException(ex.ToString());
}
oparetion.End(list.DefaultViewUrl);
}
finally
{
if(oparetion!
=null)
{
oparetion.Dispose();
}
}
转向
//转向到该list工作流设立页面
SPUtility.Redirect("WrkSetng.aspx?
List="+taskList.ID,
SPRedirectFlags.RelativeToLayoutsPage,HttpContext.Current);
转到错误页
SPUtility.TransferToErrorPage("TheCreateChildControlsfunctionoftheAjaxBaseParthasnotbeencalled.Youprobablyneedtoadd""base.CreateChildControls()""tothetopofyourCreateChildControlsoverride.");
成员名称
阐明
CheckUrl
ChecktheredirectUniformResourceLocator(URL).
Default
Usedefaultsettingsfortheredirect.
DoNotEncodeUrl
DonotencodetheredirectURL.
DoNotEndResponse
Donotendtheresponseaftertheredirect.
RelativeToLayoutsPage
相对Layouts地址Theredirectoccursrelativetothelayoutspage.
RelativeToLocalizedLayoutsPage
相对触发layouts中Page地址Theredirectoccursrelativetothelocalizedlayoutspage.
Static
静态地址,非相对地址Theredirectisstatic.
Trusted
Theredirectistrusted.
UseSource
使用URL中Source地址Usethesourcefortheredirect.
内容类型
SPWeb.AvailableContentTypes得到当前web所有活动内容类型
SPWeb.ContentTypes得到布置到当前web上内容类型,不要用这个。
Web顾客list
web.SiteUserInfoList
AD操作
DirectoryEntrydi=newDirectoryEntry("LDAP:
//ADServer/OU=开发部,administrator,pass,AuthenticationTypes.Secure);
广州㊣-jian(简)说:
这句应当是最核心了
广州㊣-jian(简)说:
然后想在“开发部”下面增长顾客,就用di.Children.Add就可以了
List附件读取
怎么获得sharepoint表单库中表单附件数据,我想将附件数据单独提取出来,但是提取信息全是BASE64编码,有无这方面信息或资料,
BASE64解码不就完了
System.Convert.FromBase64String
模仿顾客代码
stringsiteUrl=":
82/sites/sjs";
//一方面用管理员身份取到某个顾客Token,必要,非管理员无法模仿
SPSitesite=newSPSite(siteUrl);
//此时顾客为SHAREPOINT"system
Response.Write(site.RootWeb.CurrentUser);
SPUseruser=site.RootWeb.SiteUsers["saicmotorlab""user1"];
//运用顾客Token构造新Site对象
SPSitesiteWithUser=newSPSite(siteUrl,user.UserToken);
SPWebwebWithUser=siteWithUser.RootWeb;
//此时顾客为SAICMOTORLAB"user1
Response.Write(webWithUser.CurrentUser);
SPListlistWithUser=webWithUser.Lists["simeList"];
//dothercode
PeopleEditor控件
PeopleEditor.SelectionSet="User,DL,SecGroup";
代表可以选取顾客,也可以选取组
工作流历史登记表
http:
//cnsh-10apl1/ProjectManagement/Lists/WorkflowHistory/
Infopath中为下拉框添加值
testNode.AppendChildElement(testNode.Prefix,"AddElm",testNode.NamespaceURI,string.Empty);
AJAX实现
3:
在有关MasterPage
里添加_spSuppressFormOnSubmitWrapper=true;
4.在你写好UserControlPage_load事件里添加
if(this.Page.Form!
=null)
{
stringformOnSubmitAtt=this.Page.Form.Attributes["onsubmit"];
if(formOnSubmitAtt=="return_spFormOnSubmitWrapper();")
{
this.Page.Form.Attributes["onsubmit"]=
"_spFormOnSubmitWrapper();";
}
}
ScriptManager.RegisterStartupScript(this,
typeof([你UserControlClassName]),"UpdatePanelFixup","_spOriginalFormAction=
document.forms[0].action;_spSuppressFormOnSubmitWrapper=true;",true);
当PersonorGroup字段容许多人时,通过sdk对象读取顾客信息
List
List
SPFieldUserValueCollectionvalues=(SPFieldUserValueCollection)item["人员或组栏"];
foreach(SPFieldUserValuevalueinvalues)
{
if(value.User!
=null)
{
users.Add(value.User);
}
else
{
SPGroupgroup=web.Groups.GetByID(value.LookupId);
groups.Add(group);
foreach(SPUseruseringroup.Users)
{
users.Add(user);
}
}
}
SPFieldLookupValueCollectionvalues=(SPFieldLookupValueCollection)item["Users"];
SPFieldLookupValueCollectionvalues=item["Users"].ToString();
stringinitUsers="";
foreach(SPFieldLookupValuevalueinvalues)
{
intvalueID=value.LookupId;
stringvalueTitle=value.LookupValue;
}
代码启动工作流
获取spworkflowmanager获取spworkflowassociation,针对一种item启动
向Item中添加附件
if(fileUploadAttach.HasFile)
{
Streamstream=fileUploadAttach.PostedFile.InputStream;
stream.Position=0;
byte[]buffer=newbyte[stream.Length];
stream.Read(buffer,0,(int)stream.Length);
itemNew.Attachments.Add(fileUploadAttach.PostedFile.FileName,buffer);
itemNew.Update();
itemNew.ParentList.Update();
stream.Close();
}
CAML查找Lookup型
顾客型
"
"
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.BinaryWrite(文献流);
Response.End();
多文献上传
SPFileCollectiondestFiles=
siteCollection.AllWebs["Destination_Site"]
.Folders["Destination_DocLib"].Files;
foreach(SPFilesrcFileinsrcFolder.Files)
{
if(srcFile.TimeLastModified<
Convert.ToDateTime("12/5/12:
00:
00AM"))
{
stringdestURL=destFiles.Folder.Url+"/"+srcFile.Name;
byte[]binFile=srcFile.OpenBinary();
destFiles.Add(destURL,binFile,true);
}
}
工作流中权限
先HybridDictionary一种对象叫task1permission,然后task1permission.Add(taskProps.AssignedTo,SPRoleType.Contributor),最后将task1permission赋值给task
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 知识点 总结 大全