zoukankan      html  css  js  c++  java
  • 如何:创建基于规则的访问群体

    Microsoft SharePoint Server 2010 支持根据访问群体规则、SharePoint 组和 Microsoft Exchange 通讯组列表 (DL) 成员资格来设定内容的目标。此外,SharePoint Server 2010 提供在列表项级别而不只是在列表级别设定内容目标的能力。

    此代码示例演示如何创建一个可设定为内容目标的基于规则的访问群体。

    注释注释

    在此示例中仅创建访问群体;未搜集访问群体,并且未添加规则。可以通过使用用户界面或对象模型来添加规则,然后通过使用用户界面来搜集访问群体。在对象模型中不支持搜集访问群体。

    在运行此代码示例之前,另外在 Microsoft Visual Studio 项目中添加以下引用:

    Microsoft.Office.Server.dll

    Microsoft.Office.Server.UserProfiles.dll

    Microsoft.SharePoint.dll

    System.Web.dll

    image

     

    using System;
    using System.Collections.Generic;
    using System.Text;
    using Microsoft.SharePoint.Administration;
    using Microsoft.Office.Server.Audience;
    using Microsoft.SharePoint;
    using Microsoft.Office.Server;
    using System.Web;
    
    namespace AudienceConsoleApp
    {
        class Program
        {
            static void Main(string[] args)
            {
                try
                {
                    using (SPSite site = new SPSite("http://moss:8001"))
                    {
                        SPServiceContext context = SPServiceContext.GetContext(site);
                        AudienceManager audManager = new AudienceManager(context);
    
                        AudienceCollection ac = audManager.Audiences;
                        Audience a = null;
                        string sAudName = "MOSS2010规则访问群体";
                        string sDescription = "MOSS2010规则访问群体";
    
                        try
                        {
                            a = ac.Create(sAudName, sDescription);
    

                       Console.WriteLine("创建成功");
                       Console.Read();

                        }
                        catch (AudienceDuplicateNameException e)
                        {
                            //Your exception handling code here
                        }
                        catch (AudienceException e1)
                        {
                            //Your exception handling code here
                        }
                    }
    
                }
                catch (Exception exception)
                {
                    Console.WriteLine(exception.ToString());
                    Console.Read();
                }
    
            }
        }
    
    
    }
    image
    打开http://moss:8001的某个列表的目标访问群体
    image
    image
    image
  • 相关阅读:
    swoole 安装方法 使用即时聊天
    git的介绍以及简单应用
    curl的应用
    linux下监听和同步代码配置
    mac skim 修改背景色
    php 编译安装的一个 configure 配置
    mac mysql error You must reset your password using ALTER USER statement before executing this statement.
    yii2 控制器里 action 大小写组合造成的路由问题
    warning : json_decode(): option JSON_BIGINT_AS_STRING not implemented in xxx
    redis 自启动脚本
  • 原文地址:https://www.cnblogs.com/love007/p/2530652.html
Copyright © 2011-2022 走看看