zoukankan      html  css  js  c++  java
  • SharePoint 常用操作杂谈

    前言

    本文完全原创,转载请说明出处,希望对大家有用。

    本篇博客是个人总结,一方面以便日后查看,另一方面希望能为其他人提供一些便利。

    阅读目录

    正文

     SharePoint 2010 UserProfile 添加属性
    以下方法是为了将自定义属性添加到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 = 100; 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();
                }
            }
     Taxonomy字段绑定TermSet
         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">123</Value>
      </Eq>
    </Where>
    
    <Where>
      <Eq>
        <FieldRef Name="Author" LookupId="True" />
        <Value Type="Lookup">123</Value>
      </Eq>
    </Where>
    
    <Where>
      <Eq>
        <FieldRef Name="Author" />
        <Value Type="Integer">
          <UserID />
        </Value>
      </Eq>
    </Where>
  • 相关阅读:
    20191317王鹏宇第四章学习笔记
    20191317王鹏宇2.3.1测试
    树莓派openeuler安装openssl及其实践
    树莓派实验指导第三章实验
    树莓派openeuler的安装以及ukui桌面的安装并安装远程桌面vnc
    20191317王鹏宇鲲鹏服务器测试
    反汇编测试
    信息安全系统设计与实现第八周:《Unix/Linux系统编程》第五章学习笔记
    团队作业三
    信息安全系统设计与实现第七周:《Unix/Linux系统编程》第四章学习笔记
  • 原文地址:https://www.cnblogs.com/renzh/p/3423468.html
Copyright © 2011-2022 走看看