SharePoint 常用操作杂谈
前言
本文完全原创,转载请说明出处,希望对大家有用。
本篇博客是个人总结,一方面以便日后查看,另一方面希望能为其他人提供一些便利。
阅读目录
正文
以下方法是为了将自定义属性添加到SharePoint UserProfile中
SPServiceContext context =SPServiceContext.GetContext(site);
UserProfileConfigManager upcm = new UserProfileConfigManager(context);
ProfilePropertyManager ppm = upcm.ProfilePropertyManager;
CorePropertyManager cpm = ppm.GetCoreProperties();
if (cpm.GetPropertyByName(name) == null)
{
CoreProperty cp = cpm.Create(false);
cp.Name = name;
cp.DisplayName = name;
cp.Type = PropertyDataType.StringSingleValue;
cp.Length = ;
cpm.Add(cp);
ProfileTypePropertyManager ptpm =ppm.GetProfileTypeProperties(ProfileType.User);
ProfileTypeProperty ptp = ptpm.Create(cp);
ptpm.Add(ptp);
ProfileSubtypeManager psm =ProfileSubtypeManager.Get(context);
ProfileSubtype ps = psm.GetProfileSubtype(ProfileSubtypeManager.GetDefaultProfileName(ProfileType.User));
ProfileSubtypePropertyManager pspm = ps.Properties;
ProfileSubtypeProperty psp = pspm.Create(ptp);
psp.IsUserEditable = true;
psp.PrivacyPolicy = PrivacyPolicy.OptIn;
psp.DefaultPrivacy = Privacy.Organization;
pspm.Add(psp);
}
如果需要新增的属性是一个Taxonomy类型的字段,则加入以下代码:
TaxonomySession taxonomySession = new TaxonomySession(site);
TermStore termStore = taxonomySession.DefaultSiteCollectionTermStore;
Group group = termStore.Groups[your group name];
TermSet termSet = group.TermSets[your Termset name];
cp.TermSet = termSet;
通常我们在发布自定义母板页的同时希望将站点默认模板页修改为自定义母板页
public void changeCustomMasterPage(SPWeb web, string masterpageurl,bool isCustomMasterPage)
{
SPFile newMasterPageFile = web.GetFile(master);
if (newMasterPageFile.Exists)
{
if (isCustomMasterPage)
web.CustomMasterUrl = newMasterPageFile.ServerRelativeUrl;
else
web.MasterUrl = newMasterPageFile.ServerRelativeUrl;
web.Update();
}
}
public static void BindTermSet(TaxonomyField field, TermSet termSet, bool isPathRendered)
{
try
{
field.SspId = termSet.TermStore.Id;
field.TermSetId = termSet.Id;
field.TargetTemplate = string.Empty;
field.AnchorId = Guid.Empty;
field.IsPathRendered = isPathRendered;
field.Update(true);
}
catch (Exception ex)
{
throw ex;
}
}
Query Author
<Where>
<Eq>
<FieldRef Name="Author" LookupId="True" />
<Value Type="User"></Value>
</Eq>
</Where> <Where>
<Eq>
<FieldRef Name="Author" LookupId="True" />
<Value Type="Lookup"></Value>
</Eq>
</Where> <Where>
<Eq>
<FieldRef Name="Author" />
<Value Type="Integer">
<UserID />
</Value>
</Eq>
</Where>
SharePoint 常用操作杂谈的更多相关文章
- 【三】用Markdown写blog的常用操作
本系列有五篇:分别是 [一]Ubuntu14.04+Jekyll+Github Pages搭建静态博客:主要是安装方面 [二]jekyll 的使用 :主要是jekyll的配置 [三]Markdown+ ...
- php模拟数据库常用操作效果
test.php <?php header("Content-type:text/html;charset='utf8'"); error_reporting(E_ALL); ...
- Mac OS X常用操作入门指南
前两天入手一个Macbook air,在装软件过程中摸索了一些基本操作,现就常用操作进行总结, 1关于触控板: 按下(不区分左右) =鼠标左键 control+按下 ...
- mysql常用操作语句
mysql常用操作语句 1.mysql -u root -p 2.mysql -h localhost -u root -p database_name 2.列出数据库: 1.show datab ...
- nodejs配置及cmd常用操作
一.cmd常用操作 1.返回根目录cd\ 2.返回上层目录cd .. 3.查找当前目录下的所有文件dir 4.查找下层目录cd window 二.nodejs配置 Node.js安装包及源码下载地址为 ...
- Oracle常用操作——创建表空间、临时表空间、创建表分区、创建索引、锁表处理
摘要:Oracle数据库的库表常用操作:创建与添加表空间.临时表空间.创建表分区.创建索引.锁表处理 1.表空间 ■ 详细查看表空间使用状况,包括总大小,使用空间,使用率,剩余空间 --详细查看表空 ...
- SharePoint常用目录介绍
SharePoint常用目录介绍 stsadm命令管理程序目录:C:\Program Files\Common Files\Microsoft Shared\web server extensions ...
- python 异常处理、文件常用操作
异常处理 http://www.jb51.net/article/95033.htm 文件常用操作 http://www.jb51.net/article/92946.htm
- byte数据的常用操作函数[转发]
/// <summary> /// 本类提供了对byte数据的常用操作函数 /// </summary> public class ByteUtil { ','A','B',' ...
随机推荐
- MySQL慢查询查找和调优测试
MySQL慢查询查找和调优测试,接下来详细介绍,需要了解的朋友可以参考下.本文参考自:http://www.jbxue.com/db/4376.html 编辑 my.cnf或者my.ini文件,去除 ...
- RSA加密的测试demo
使用.net自带的RSA,需要引用System.Security.Cryptography 测试环境.net4.6 static void Main(string[] args) { var RSA ...
- Form表单——例子
Form Form的验证思路 前端:form表单 后台:创建form类,当请求到来时,先匹配,匹配出正确和错误信息. Django的Form验证实例: 创建project,进行基础配置文件配置 STA ...
- asp.net 简单分页打印
<html> <head> <title>看看</title> <meta http-equiv="Content-Type" ...
- Linux - Windows10连接linux服务器
当我们通过windows连接服务器时,大多数用的是ssh客户端软件,推荐使用ssh,安全系数比较高.下面介绍用telnet连接服务器. 客户端:C:\Users\dell>systeminfo主 ...
- C++ 运算符重载二(一元运算符重载)
//一元运算符重载 #include<iostream> using namespace std; class Point { public: Point(int x,int y){ th ...
- 使用PULL解析XML文件
转载博文1:http://blog.csdn.net/wangkuifeng0118/article/details/7313241 XmlPull和Sax类似,是基于流(stream)操作文件,然后 ...
- SQL之Join的使用
一.基本概念 关于sql语句中的连接(join)关键字,是较为常用而又不太容易理解的关键字,下面这个例子给出了一个简单的解释 –建表user1,user2: table1 : create table ...
- getRequestDispatcher 和sendRedirect区别及路径问题
getRequestDispatcher 和sendRedirect区别 getRequestDispatcher是服务器内部跳转,地址栏信息不变,只能跳转到web应用内的网页. sendRedi ...
- wifi的web 认证。
wifi的web 认证.wifidog+authpuppy+php 或者Wiwiz Auth API