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',' ...
随机推荐
- CentOS 6.4 yum安装chrome
CentOS 6.4安装chrome浏览器 vim /etc/yum.repos.d/CentOS-Base.repo 根据你的系统增加一个节点 32-bit [google] name=Google ...
- 常见的安装包制作程序installer
1. Windows安装程序制作工具 NSISNSIS (Nullsoft Scriptable Install System) 是一个专业开源的制作 windows 安装程序的工具.http://n ...
- 收集整理的mybatis资料
这是个系列文章,讲的非常不错 mybatis 详解(一)------JDBC https://www.cnblogs.com/ysocean/p/7271600.html mybatis http ...
- PHP 生成唯一的激活码
<? php /** * 生成永远唯一的激活码 * @return string */ function create_guid($namespace = null) { static $gui ...
- 0061 Spring MVC的数据格式化--Formatter--FormatterRegistrar--@DateTimeFormat--@NumberFormat
Converter只完成了数据类型的转换,却不负责输入输出数据的格式化工作,日期时间.货币等虽都以字符串形式存在,却有不同的格式. Spring格式化框架要解决的问题是:从格式化的数据中获取真正的数据 ...
- shell学习笔记之控制结构(三)
1.if语句 if condition then statements esle statements fi 例: #!/bin/sh echo "Is it morning? Please ...
- pc或者微信上用pdf.js在线预览pdf和word
最近项目要求pdf和word可以在线预览功能,pc端还好解决,但是微信端就有点坑了,pc端原来的思路是将文件转成base64,然后用html格式显示 ,但是微信端不支持, 这种方式就pass掉了,谷歌 ...
- xmapp+netbeans调试
1.netbeans的设置 2.修改php.ini 如下: [XDebug]zend_extension = "D:\dev\xampp\php\ext\php_xdebug.dll&quo ...
- SQL查询优化联合索引 与 单一列的索引
目前WEB的普及太快,在实际的开发中,一旦遇到大数据量的时候就需要做到优化,让查询的更快,才能给客户更好的体验,也能够在程序上避免timeout. 部分转载自:https://www.cnblogs. ...
- Unix系统编程()在堆上分配内存
在堆上分配内存:malloc和free 一般情况下,C程序使用malloc函数族在堆上分配和释放内存.较之brk和sbrk,这些函数具备不少优点: 属于C语言标准的一部分 更易于在多线程程序中使用 接 ...