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',' ...
随机推荐
- [Jobdu] 题目1493:公约数
题目描述: 给定两个正整数a,b(1<=a,b<=100000000),计算他们公约数的个数.如给定正整数8和16,他们的公约数有:1.2.4.8,所以输出为4. 输入: 输入包含多组测试 ...
- Cadence技巧01:利用Excel速新建原理图元件库
Cadence技巧01:利用Excel速新建原理图元件库 听语音 | 浏览:1698 | 更新:2015-07-02 09:41 | 标签:excel 1 2 3 4 5 6 7 分步阅读 一键约师傅 ...
- java中Keytool的使用总结 (加密 密钥(key)和证书(certificates))
http://blog.chinaunix.net/uid-17102734-id-2830223.html
- FreeRTOS 中断优先级配置(重要)
以下转载自安富莱电子: http://forum.armfly.com/forum.php NVIC 的全称是 Nested vectored interrupt controller,即嵌套向量中断 ...
- Makefile 9——为依赖关系文件建立依赖关系
现在我们再对complicated项目做一些更改,增加程序文件间依赖关系的复杂度. /× main.c ×/ #include"foo.h" int main(void) { fo ...
- cf 450c Jzzhu and Chocolate
Jzzhu and Chocolate time limit per test 1 second memory limit per test 256 megabytes input standard ...
- 一款基于jQuery的图片分组切换焦点图插件
这是一款基于jQuery的图片切换焦点图插件,这款jQuery焦点图插件的特点是图片可以分组切换,也就是说一次可以切换多张图片,相比其他焦点图插件,它能节省更多的空间,可以向用户展示更多的图片,非常实 ...
- 非常多学ThinkPHP的新手会遇到的问题
在模板传递变量的时候,非常多视频教程都使用$v.channel的方式.例如以下: <a href="{:U('Chat/set',array('id'=>$v.channel)) ...
- finals的使用
//----------------------------------------Finals--------------------------- public class Finals { pu ...
- 很多人都不知道的监听微信、支付宝等移动app及浏览器的返回、后退、上一页按钮的事件方法
版权声明:本文为博主原创文章,未经博主允许不得转载. 在实际的应用中,我们常常需要实现在移动app和浏览器中点击返回.后退.上一页等按钮实现自己的关闭页面.调整到指定页面或执行一些其它操作的 需求,那 ...