SlideShare uma empresa Scribd logo
1 de 40
Working with site policies in
SharePoint 2013
DRAGAN PANJKOV, PLANB.

B: WWW.DRAGAN-PANJKOV.COM
T: @PANJKOV

SHAREPOINT AND PROJECT CONFERENCE ADRIATICS 2013
ZAGREB, NOVEMBER 27-28 2013
sponsors
About
• Dragan Panjkov
• Working with SharePoint since 2007
• www.dragan-panjkov.com
• www.twitter.com/panjkov

• PlanB. d.o.o.
• www.planb.ba

• SharePoint user group
• www.1sug.com
Agenda
• Information Management Policies
• Site Policies
• Configuration steps needed to enable Site Policies on sites
• Creating Site Policies in SharePoint UI
• Working with Site Policies using Server OM
• Working with Site Policies using Client OM
Information management policy?
• An information management policy is a set of rules that govern
the availability and behavior of a certain type of important
content. Policy enables administrators to control and
evaluate who can access information, how long to retain
information, and how effectively people are complying with the
policy.
In other words
• Information Management Policy connects business need and
technical implementation of the solution to ensure that
standards are met
Business
Outcomes

Information
Classification

Functional
Preferences

Information
Architecture

Functional
Design

Information
Management
Standards

Information
Management
Policies

Information
Management
Architecture

Technical
Considerations

Service
Management
Policies

Service
Architecture

Project Constraints
Budget, Timeframe, Resources
Information Management Policy Scopes
• List
• Library
• Content Type
• Site
Site Retention?
• How do we control site lifecycle?
• Are we able to track old and unused sites?
• Are we able to easily delete old, unused, expired sites?
Site Policies
• Opportunity to predefine retention rules for sites
• Assign retention policy at site creation
• Site Policies can be configured that sites are:
• Closed and then deleted automatically
• Deleted automatically after certain period of time
• Marked as read-only

• Site Policies can be published in Content Type Hub
Enabling Site Policy functionality
In UI:
• Enable features in Site Collection
• Library and Folder Based Retention
• Site Policy
• Hidden feature “Record Resources” activated automatically

In onet.xml
<SiteFeatures>
<Feature ID="5bccb9a4-b903-4fd1-8620-b795fa33c9ba" Name="RecordResources" />
<Feature ID="063c26fa-3ccc-4180-8a84-b6f98e991df3" Name="LocationBasedPolicy" />
<Feature ID="2fcd5f8a-26b7-4a6a-9755-918566dba90a" Name="ProjectBasedPolicy" />
</SiteFeatures>
CREATING AND APPLYING SITE POLICIES IN UI
Creating Site Policies in UI
Creating Site Policies in UI
Creating Site Policies in UI
Creating Site Policies in UI
Creating Site Policies in UI
Applying Site Policies in the UI
Applying Site Policies in the UI
Applying Site Policies in the UI
Applying Site Policies in the UI
Site Policies in SSOM
namespace Microsoft.Office.RecordsManagement.InformationPolicy
{
public class ProjectPolicy
{
public string Description { get; internal set; }
public string EmailBody { get; set; }
public string EmailBodyWithTeamMailbox { get; set; }
public string EmailSubject { get; set; }
public string Name { get; internal set; }
public
public
public
public
public
public
public
public
public
public
public
}
}

static void ApplyProjectPolicy(SPWeb web, ProjectPolicy projectPolicy);
static void CloseProject(SPWeb web);
static bool DoesProjectHavePolicy(SPWeb web);
static ProjectPolicy GetCurrentlyAppliedProjectPolicyOnWeb(SPWeb web);
static DateTime GetProjectCloseDate(SPWeb web);
static DateTime GetProjectExpirationDate(SPWeb web);
static List<ProjectPolicy> GetProjectPolicies(SPWeb web);
static bool IsProjectClosed(SPWeb web);
static void OpenProject(SPWeb web);
static void PostponeProject(SPWeb web);
void SavePolicy();
SERVER-SIDE OBJECT MODEL DEMOS
Create Site Policies
// ProjectPolicy Content Type ID
SPContentTypeId policyCTID= new SPContentTypeId("0x010085EC78BE64F9478aAE3ED069093B9963");
SPContentTypeCollection contentTypes = site.RootWeb.ContentTypes;
// ProjectPolicy is parent content type
SPContentType parentContentType = contentTypes[policyCTID];
// we create new content type based on ProjectPolicy
policyContentType = new SPContentType(parentContentType, contentTypes, "New Project Policy");
policyContentType = contentTypes.Add(policyContentType);
policyContentType.Group = parentContentType.Group;
policyContentType.Hidden = true;
policyContentType.Update();
// Final step is to create new Policy with new content type
Policy.CreatePolicy(policyContentType, null);
Read Site Policies that exist on site
private static void ReadProjectPolicies()
{
using (SPSite targetSite = new SPSite(siteUrl))
{
SPWeb targetWeb = targetSite.RootWeb;
List<ProjectPolicy> projectPolicies = ProjectPolicy.GetProjectPolicies(targetWeb);
if (projectPolicies!= null && projectPolicies.Count > 0)
{
Console.WriteLine("Project Policies on web {0}", siteUrl);
foreach (var item in projectPolicies)
{
Console.WriteLine("Name: {0}",item.Name);
Console.WriteLine("Desc: {0}",item.Description);
Console.WriteLine();
}
}
Console.WriteLine();
try
{
targetWeb.Dispose();
}
catch { }
}
}
Get Applied Policy
private static void GetAppliedPolicy()
{
using (SPSite targetSite = new SPSite(siteUrl))
{
SPWeb targetWeb = targetSite.RootWeb;
ProjectPolicy appliedPolicy = ProjectPolicy.GetCurrentlyAppliedProjectPolicyOnWeb(targetWeb);
if (appliedPolicy != null)
{
Console.WriteLine("Currently applied Project Policy on web {0}", siteUrl);
Console.WriteLine(appliedPolicy.Name);
Console.WriteLine(appliedPolicy.Description);
}
else
{
Console.WriteLine("Project Policy is not applied on web {0}", siteUrl);
}
Console.WriteLine();
try
{
targetWeb.Dispose();
}
catch { }
}
}
Is Policy Applied?
private static void IsPolicyApplied()
{
using (SPSite targetSite = new SPSite(siteUrl))
{
SPWeb targetWeb = targetSite.RootWeb;
bool isPolicyApplied = ProjectPolicy.DoesProjectHavePolicy(targetWeb);
if (isPolicyApplied)
{
Console.WriteLine("Web has policy applied {0}", siteUrl);
}
else
{
Console.WriteLine("Project Policy is not applied on web {0}", siteUrl);
}
Console.WriteLine();
try
{
targetWeb.Dispose();
}
catch { }
}
}
Apply Policy
private static void ApplyPolicySSOM()
{
string policyName = "DEVSITE DoNotClose-ReadOnly Policy";
using (SPSite targetSite = new SPSite(siteUrl))
{
SPWeb targetWeb = targetSite.RootWeb;
List<ProjectPolicy> webPolicies = ProjectPolicy.GetProjectPolicies(targetWeb);
ProjectPolicy selectedPolicy = webPolicies.Where(p => p.Name ==
policyName).FirstOrDefault();
if (selectedPolicy != null)
{
ProjectPolicy.ApplyProjectPolicy(targetWeb, selectedPolicy);
targetWeb.Update();
Console.WriteLine("Successfully applied policy '{0}' on web
'{1}'", policyName, targetWeb);
}
}
}
Get Project Close and Expiration Date
private static void GetProjectCloseExpirationDate()
{
using (SPSite targetSite = new SPSite(siteUrl))
{
SPWeb targetWeb = targetSite.RootWeb;
DateTime closedDate = ProjectPolicy.GetProjectCloseDate(targetWeb);
DateTime expirationDate = ProjectPolicy.GetProjectExpirationDate(targetWeb);
if (closedDate != DateTime.MinValue)
{
Console.WriteLine("Close Date: {0}", closedDate);
}
if (expirationDate != DateTime.MinValue)
{
Console.WriteLine("Expiration Date: {0}", expirationDate);
}
Console.WriteLine();
try
{

targetWeb.Dispose();
}
catch { }
}
}
Open Closed Site ELEVATED
private static void OpenProject()
{
using (SPSite site = new SPSite(siteUrl))
{
SPSecurity.RunWithElevatedPrivileges(delegate
{
using (SPSite targetSite = new SPSite(siteUrl))
{
SPWeb targetWeb = targetSite.RootWeb;
bool isClosed = ProjectPolicy.IsProjectClosed(targetWeb);
Console.WriteLine("Site is Closed! {0}", siteUrl);
if (isClosed)
{
Console.WriteLine("Trying to open site.");
ProjectPolicy.OpenProject(targetWeb);
Console.WriteLine("Site is now Open! {0}", siteUrl);
}
Console.WriteLine();

try
{
targetWeb.Dispose();
}
catch { }
}
});
}
}
Site Policies in CSOM
namespace Microsoft.SharePoint.Client.InformationPolicy
{
[ScriptType("SP.InformationPolicy.ProjectPolicy", ServerTypeId = "{ec5e0a70-0cc3-408f-a4dc-1bb3495aac75}")]
public class ProjectPolicy : ClientObject
{
[EditorBrowsable(EditorBrowsableState.Never)]
public ProjectPolicy(ClientRuntimeContext context, ObjectPath objectPath);
[Remote]
public static void ApplyProjectPolicy(ClientRuntimeContext context, Web web, ProjectPolicy projectPolicy);
[Remote]
public static void CloseProject(ClientRuntimeContext context, Web web);
[Remote]
public static ClientResult<bool> DoesProjectHavePolicy(ClientRuntimeContext context, Web web);
[Remote]
public static ProjectPolicy GetCurrentlyAppliedProjectPolicyOnWeb(ClientRuntimeContext context, Web web);
[Remote]
public static ClientResult<DateTime> GetProjectCloseDate(ClientRuntimeContext context, Web web);
[Remote]
public static ClientResult<DateTime> GetProjectExpirationDate(ClientRuntimeContext context, Web web);
[Remote]
public static ClientObjectList<ProjectPolicy> GetProjectPolicies(ClientRuntimeContext context, Web web);
protected override bool InitOnePropertyFromJson(string peekedName, JsonReader reader);
[Remote]
public static ClientResult<bool> IsProjectClosed(ClientRuntimeContext context, Web web);
[Remote]
public static void OpenProject(ClientRuntimeContext context, Web web);
[Remote]
public static void PostponeProject(ClientRuntimeContext context, Web web);
[Remote]
public void SavePolicy();
}
}
CLIENT-SIDE OBJECT MODEL DEMOS
Read Site Policies that exist on site
private static void ReadProjectPoliciesCsom()
{
ClientContext policyContext = new ClientContext(siteUrl);
Web targetWeb = policyContext.Web;
ClientObjectList<ProjectPolicy> projectPolicies =
ProjectPolicy.GetProjectPolicies(policyContext, targetWeb);
policyContext.Load(projectPolicies);
policyContext.ExecuteQuery();
if (projectPolicies != null && projectPolicies.Count > 0)
{
Console.WriteLine("Project Policies on web {0}", siteUrl);
foreach (var item in projectPolicies)
{
Console.WriteLine("Name: {0}", item.Name);
Console.WriteLine("Desc: {0}", item.Description);
Console.WriteLine();
}
}
Console.WriteLine();
}
Get Applied Policy
private static void GetAppliedPolicyCsom()
{
ClientContext policyContext = new ClientContext(siteUrl);
Web targetWeb = policyContext.Web;
ClientResult<bool> isPolicyApplied = ProjectPolicy.DoesProjectHavePolicy(policyContext, targetWeb);
policyContext.ExecuteQuery();
if (isPolicyApplied.Value)
{
ProjectPolicy appliedPolicy = ProjectPolicy.GetCurrentlyAppliedProjectPolicyOnWeb(policyContext, targetWeb);
policyContext.Load(appliedPolicy);
policyContext.ExecuteQuery();
if (appliedPolicy.TypedObject.ServerObjectIsNull != true)
{
Console.WriteLine("Currently applied Project Policy on web {0}", siteUrl);
Console.WriteLine(appliedPolicy.Name);
Console.WriteLine(appliedPolicy.Description);
}
}
else
{
Console.WriteLine("Project Policy is not applied on web {0}", siteUrl);
}
Console.WriteLine();
}
Is Policy Applied?
private static void IsPolicyAppliedCsom()
{
ClientContext policyContext = new ClientContext(siteUrl);
Web targetWeb = policyContext.Web;
ClientResult<bool> isPolicyApplied =
ProjectPolicy.DoesProjectHavePolicy(policyContext, targetWeb);
policyContext.ExecuteQuery();
if (isPolicyApplied.Value)
{
Console.WriteLine("Web has policy applied {0}", siteUrl);
}
else
{
Console.WriteLine("Project Policy is not applied on web {0}", siteUrl);
}
Console.WriteLine();
}
Apply Policy
private static void ApplyPolicyCsom()
{
string policyName = "DEVSITE DoNotClose-ReadOnly Policy";

ClientContext policyContext = new ClientContext(siteUrl);

targetWeb);

Web targetWeb = policyContext.Web;
ClientObjectCollection<ProjectPolicy> webPolicies = ProjectPolicy.GetProjectPolicies(policyContext,
policyContext.Load(webPolicies);
policyContext.ExecuteQuery();

ProjectPolicy selectedPolicy = webPolicies.Where(p => p.Name == policyName).FirstOrDefault();
if (selectedPolicy != null)
{
ProjectPolicy.ApplyProjectPolicy(policyContext, targetWeb, selectedPolicy);
policyContext.ExecuteQuery();
Console.WriteLine("Successfully applied policy '{0}' on web '{1}'", policyName, siteUrl);
}
Console.WriteLine();
}
Get Project Close and Expiration Date
private static void GetProjectCloseExpirationDateCsom()
{
ClientContext policyContext = new ClientContext(siteUrl);
Web targetWeb = policyContext.Web;
ClientResult<DateTime> closedDate = ProjectPolicy.GetProjectCloseDate(policyContext, targetWeb);
ClientResult<DateTime> expirationDate = ProjectPolicy.GetProjectExpirationDate(policyContext, targetWeb);
policyContext.ExecuteQuery();
if (closedDate.Value != DateTime.MinValue)
{
Console.WriteLine("Close Date: {0}", closedDate.Value);
}
if (expirationDate.Value != DateTime.MinValue)
{
Console.WriteLine("Expiration Date: {0}", expirationDate.Value);
}
Console.WriteLine();
}
Close Site
private static void CloseProjectCsom()
{
ClientContext policyContext = new ClientContext(siteUrl);
Web targetWeb = policyContext.Web;
ClientResult<bool> isClosed = ProjectPolicy.IsProjectClosed(policyContext, targetWeb);
policyContext.ExecuteQuery();
if (!isClosed.Value)
{
ProjectPolicy.CloseProject(policyContext, targetWeb);
}
policyContext.ExecuteQuery();
isClosed = ProjectPolicy.IsProjectClosed(policyContext, targetWeb);
policyContext.ExecuteQuery();
if (isClosed.Value)
{
Console.WriteLine("Project is closed! {0}", siteUrl);
}
else
{
Console.WriteLine("Project is NOT closed!");
}
Console.WriteLine();
}
Resources
• http://msdn.microsoft.com/enus/library/microsoft.office.recordsmanagement.informationpolicy.proj
ectpolicy_members.aspx
• http://technet.microsoft.com/en-us/library/jj219569.aspx
• http://blog.dragan-panjkov.com/archive/2013/06/30/creating-sitepolicy-in-sharepoint-2013-using-server-code.aspx
• http://blog.dragan-panjkov.com/archive/2013/10/27/configuring-sitepolicy-in-sharepoint-2013-using-server-code.aspx
• http://blogs.technet.com/b/tothesharepoint/archive/2013/03/28/sitepolicy-in-sharepoint.aspx
• http://stevemannspath.blogspot.com/2012/08/sharepoint-2013-siteretention-getting.html
• http://www.booden.net/ProjectPolicy.aspx
questions?
WWW.DRAGAN-PANJKOV.COM

@PANJKOV
thank you.
SHAREPOINT AND PROJECT CONFERENCE ADRIATICS 2013
ZAGREB, NOVEMBER 27-28 2013

Mais conteúdo relacionado

Semelhante a Working with site policies in SharePoint 2013 - Dragan Panjkov

SharePoint Saturday Sacramento 2013 SharePoint Apps
SharePoint Saturday Sacramento 2013 SharePoint AppsSharePoint Saturday Sacramento 2013 SharePoint Apps
SharePoint Saturday Sacramento 2013 SharePoint AppsRyan Schouten
 
MuleSoft Surat Virtual Meetup#3 - Anypoint Custom Policies, API Manager (Prox...
MuleSoft Surat Virtual Meetup#3 - Anypoint Custom Policies, API Manager (Prox...MuleSoft Surat Virtual Meetup#3 - Anypoint Custom Policies, API Manager (Prox...
MuleSoft Surat Virtual Meetup#3 - Anypoint Custom Policies, API Manager (Prox...Jitendra Bafna
 
Office 365 Features for GDPR Compliance Webinar
Office 365 Features for GDPR Compliance WebinarOffice 365 Features for GDPR Compliance Webinar
Office 365 Features for GDPR Compliance WebinarNew Horizons Ireland
 
Getting started with content deployment in SharePoint 2013 SPFestDC 2015
Getting started with content deployment in SharePoint 2013 SPFestDC 2015Getting started with content deployment in SharePoint 2013 SPFestDC 2015
Getting started with content deployment in SharePoint 2013 SPFestDC 2015Prashant G Bhoyar (Microsoft MVP)
 
Suresh_Kumar_Mahala [10729857]
Suresh_Kumar_Mahala [10729857]Suresh_Kumar_Mahala [10729857]
Suresh_Kumar_Mahala [10729857]sureshmahala
 
Governance in SharePoint Premium:What's in the box?
Governance in SharePoint Premium:What's in the box?Governance in SharePoint Premium:What's in the box?
Governance in SharePoint Premium:What's in the box?Juan Carlos Gonzalez
 
Relearning SharePoint Development
Relearning SharePoint DevelopmentRelearning SharePoint Development
Relearning SharePoint Developmentbgerman
 
SharePoint 2013 Search and Creating Dynamic Content Management Solutions
SharePoint 2013 Search and Creating Dynamic Content Management SolutionsSharePoint 2013 Search and Creating Dynamic Content Management Solutions
SharePoint 2013 Search and Creating Dynamic Content Management SolutionsInnoTech
 
Consider performance and security for SharePoint WP/App
Consider performance and security for SharePoint WP/AppConsider performance and security for SharePoint WP/App
Consider performance and security for SharePoint WP/AppTuấn Hải
 
Getting Started with Site Designs and Site Scripts - SPSChi
Getting Started with Site Designs and Site Scripts - SPSChiGetting Started with Site Designs and Site Scripts - SPSChi
Getting Started with Site Designs and Site Scripts - SPSChiDrew Madelung
 
20150211 seo in drupal presentation
20150211 seo in drupal presentation20150211 seo in drupal presentation
20150211 seo in drupal presentationDagmar Muth
 
Using Microsoft Project to automate a workplace culture that works
Using Microsoft Project to automate a workplace culture that worksUsing Microsoft Project to automate a workplace culture that works
Using Microsoft Project to automate a workplace culture that worksProductivity Intelligence Institute
 
Getting Started with SharePoint Patterns and Practices Provisioning Engine-SP...
Getting Started with SharePoint Patterns and Practices Provisioning Engine-SP...Getting Started with SharePoint Patterns and Practices Provisioning Engine-SP...
Getting Started with SharePoint Patterns and Practices Provisioning Engine-SP...Prashant G Bhoyar (Microsoft MVP)
 
SharePoint Saturday San Diego - SharePoint 2013 Apps
SharePoint Saturday San Diego - SharePoint 2013 AppsSharePoint Saturday San Diego - SharePoint 2013 Apps
SharePoint Saturday San Diego - SharePoint 2013 AppsRyan Schouten
 
Developing For Multiple Environments on SharePoint Online
Developing For Multiple Environments on SharePoint OnlineDeveloping For Multiple Environments on SharePoint Online
Developing For Multiple Environments on SharePoint OnlineFrank Sikorski
 
SharePoint 2016 Hybrid Overview
SharePoint 2016 Hybrid OverviewSharePoint 2016 Hybrid Overview
SharePoint 2016 Hybrid OverviewRoy Kim
 
Governance of content, permissions & apps in sharepoint 2013
Governance of content, permissions & apps in sharepoint 2013Governance of content, permissions & apps in sharepoint 2013
Governance of content, permissions & apps in sharepoint 2013Kashish Sukhija
 
Building MuleSoft Applications with Google BigQuery Meetup 4
Building MuleSoft Applications with Google BigQuery Meetup 4Building MuleSoft Applications with Google BigQuery Meetup 4
Building MuleSoft Applications with Google BigQuery Meetup 4MannaAkpan
 
Untangling - fall2017 - week 9
Untangling - fall2017 - week 9Untangling - fall2017 - week 9
Untangling - fall2017 - week 9Derek Jacoby
 
An Introduction to Django Web Framework
An Introduction to Django Web FrameworkAn Introduction to Django Web Framework
An Introduction to Django Web FrameworkDavid Gibbons
 

Semelhante a Working with site policies in SharePoint 2013 - Dragan Panjkov (20)

SharePoint Saturday Sacramento 2013 SharePoint Apps
SharePoint Saturday Sacramento 2013 SharePoint AppsSharePoint Saturday Sacramento 2013 SharePoint Apps
SharePoint Saturday Sacramento 2013 SharePoint Apps
 
MuleSoft Surat Virtual Meetup#3 - Anypoint Custom Policies, API Manager (Prox...
MuleSoft Surat Virtual Meetup#3 - Anypoint Custom Policies, API Manager (Prox...MuleSoft Surat Virtual Meetup#3 - Anypoint Custom Policies, API Manager (Prox...
MuleSoft Surat Virtual Meetup#3 - Anypoint Custom Policies, API Manager (Prox...
 
Office 365 Features for GDPR Compliance Webinar
Office 365 Features for GDPR Compliance WebinarOffice 365 Features for GDPR Compliance Webinar
Office 365 Features for GDPR Compliance Webinar
 
Getting started with content deployment in SharePoint 2013 SPFestDC 2015
Getting started with content deployment in SharePoint 2013 SPFestDC 2015Getting started with content deployment in SharePoint 2013 SPFestDC 2015
Getting started with content deployment in SharePoint 2013 SPFestDC 2015
 
Suresh_Kumar_Mahala [10729857]
Suresh_Kumar_Mahala [10729857]Suresh_Kumar_Mahala [10729857]
Suresh_Kumar_Mahala [10729857]
 
Governance in SharePoint Premium:What's in the box?
Governance in SharePoint Premium:What's in the box?Governance in SharePoint Premium:What's in the box?
Governance in SharePoint Premium:What's in the box?
 
Relearning SharePoint Development
Relearning SharePoint DevelopmentRelearning SharePoint Development
Relearning SharePoint Development
 
SharePoint 2013 Search and Creating Dynamic Content Management Solutions
SharePoint 2013 Search and Creating Dynamic Content Management SolutionsSharePoint 2013 Search and Creating Dynamic Content Management Solutions
SharePoint 2013 Search and Creating Dynamic Content Management Solutions
 
Consider performance and security for SharePoint WP/App
Consider performance and security for SharePoint WP/AppConsider performance and security for SharePoint WP/App
Consider performance and security for SharePoint WP/App
 
Getting Started with Site Designs and Site Scripts - SPSChi
Getting Started with Site Designs and Site Scripts - SPSChiGetting Started with Site Designs and Site Scripts - SPSChi
Getting Started with Site Designs and Site Scripts - SPSChi
 
20150211 seo in drupal presentation
20150211 seo in drupal presentation20150211 seo in drupal presentation
20150211 seo in drupal presentation
 
Using Microsoft Project to automate a workplace culture that works
Using Microsoft Project to automate a workplace culture that worksUsing Microsoft Project to automate a workplace culture that works
Using Microsoft Project to automate a workplace culture that works
 
Getting Started with SharePoint Patterns and Practices Provisioning Engine-SP...
Getting Started with SharePoint Patterns and Practices Provisioning Engine-SP...Getting Started with SharePoint Patterns and Practices Provisioning Engine-SP...
Getting Started with SharePoint Patterns and Practices Provisioning Engine-SP...
 
SharePoint Saturday San Diego - SharePoint 2013 Apps
SharePoint Saturday San Diego - SharePoint 2013 AppsSharePoint Saturday San Diego - SharePoint 2013 Apps
SharePoint Saturday San Diego - SharePoint 2013 Apps
 
Developing For Multiple Environments on SharePoint Online
Developing For Multiple Environments on SharePoint OnlineDeveloping For Multiple Environments on SharePoint Online
Developing For Multiple Environments on SharePoint Online
 
SharePoint 2016 Hybrid Overview
SharePoint 2016 Hybrid OverviewSharePoint 2016 Hybrid Overview
SharePoint 2016 Hybrid Overview
 
Governance of content, permissions & apps in sharepoint 2013
Governance of content, permissions & apps in sharepoint 2013Governance of content, permissions & apps in sharepoint 2013
Governance of content, permissions & apps in sharepoint 2013
 
Building MuleSoft Applications with Google BigQuery Meetup 4
Building MuleSoft Applications with Google BigQuery Meetup 4Building MuleSoft Applications with Google BigQuery Meetup 4
Building MuleSoft Applications with Google BigQuery Meetup 4
 
Untangling - fall2017 - week 9
Untangling - fall2017 - week 9Untangling - fall2017 - week 9
Untangling - fall2017 - week 9
 
An Introduction to Django Web Framework
An Introduction to Django Web FrameworkAn Introduction to Django Web Framework
An Introduction to Django Web Framework
 

Mais de SPC Adriatics

How to secure your data in Office 365
How to secure your data in Office 365 How to secure your data in Office 365
How to secure your data in Office 365 SPC Adriatics
 
Do you know, where your sensitive data is?
Do you know, where your sensitive data is?Do you know, where your sensitive data is?
Do you know, where your sensitive data is?SPC Adriatics
 
Securing Intellectual Property using Azure Rights Management Services
Securing Intellectual Property using Azure Rights Management ServicesSecuring Intellectual Property using Azure Rights Management Services
Securing Intellectual Property using Azure Rights Management ServicesSPC Adriatics
 
Creating Workflows in Project Online
Creating Workflows in Project OnlineCreating Workflows in Project Online
Creating Workflows in Project OnlineSPC Adriatics
 
Faster than a flash behind the scenes of patching SharePoint Online
Faster than a flash   behind the scenes of patching SharePoint OnlineFaster than a flash   behind the scenes of patching SharePoint Online
Faster than a flash behind the scenes of patching SharePoint OnlineSPC Adriatics
 
Role based views in Project and Resource Center
Role based views in Project and Resource CenterRole based views in Project and Resource Center
Role based views in Project and Resource CenterSPC Adriatics
 
OneDrive, TwoDrive, Whiterive, BlueDrive (hahaha)
OneDrive, TwoDrive, Whiterive, BlueDrive (hahaha)OneDrive, TwoDrive, Whiterive, BlueDrive (hahaha)
OneDrive, TwoDrive, Whiterive, BlueDrive (hahaha)SPC Adriatics
 
SharePoint Governance and Compliance
SharePoint Governance and ComplianceSharePoint Governance and Compliance
SharePoint Governance and ComplianceSPC Adriatics
 
From analyses to successful Implementation
From analyses to successful ImplementationFrom analyses to successful Implementation
From analyses to successful ImplementationSPC Adriatics
 
The key to a successful Office 365 implementation is adoption
The key to a successful Office 365 implementation is adoptionThe key to a successful Office 365 implementation is adoption
The key to a successful Office 365 implementation is adoptionSPC Adriatics
 
10 Steps to be Successful with Enterprise Search
10 Steps to be Successful with Enterprise Search10 Steps to be Successful with Enterprise Search
10 Steps to be Successful with Enterprise SearchSPC Adriatics
 
How the Cloud Changes Business Solution Design and Delivery
How the Cloud Changes Business Solution Design and DeliveryHow the Cloud Changes Business Solution Design and Delivery
How the Cloud Changes Business Solution Design and DeliverySPC Adriatics
 
Scaling SharePoint 2016 Farms with MinRole & Other Tools
Scaling SharePoint 2016 Farms with MinRole & Other ToolsScaling SharePoint 2016 Farms with MinRole & Other Tools
Scaling SharePoint 2016 Farms with MinRole & Other ToolsSPC Adriatics
 
SharePoint 2013 Search Operations
SharePoint 2013 Search OperationsSharePoint 2013 Search Operations
SharePoint 2013 Search OperationsSPC Adriatics
 
Office Online Server 2016 - a must for on-premises installation for SharePoin...
Office Online Server 2016 - a must for on-premises installation for SharePoin...Office Online Server 2016 - a must for on-premises installation for SharePoin...
Office Online Server 2016 - a must for on-premises installation for SharePoin...SPC Adriatics
 
Custom Code-The Missing Piece of the SharePoint Governance Puzzle
Custom Code-The Missing Piece of the SharePoint Governance PuzzleCustom Code-The Missing Piece of the SharePoint Governance Puzzle
Custom Code-The Missing Piece of the SharePoint Governance PuzzleSPC Adriatics
 
SharePoint 2016 Hybrid Sites Inside Out
SharePoint 2016 Hybrid Sites Inside OutSharePoint 2016 Hybrid Sites Inside Out
SharePoint 2016 Hybrid Sites Inside OutSPC Adriatics
 
Microsoft BI demystified: SharePoint 2016 BI or for PowerBI v2?
Microsoft BI demystified: SharePoint 2016 BI or for PowerBI v2?Microsoft BI demystified: SharePoint 2016 BI or for PowerBI v2?
Microsoft BI demystified: SharePoint 2016 BI or for PowerBI v2?SPC Adriatics
 
What's New for the BI workload in SharePoint 2016 and SQL Server 2016
What's New for the BI workload in SharePoint 2016 and SQL Server 2016What's New for the BI workload in SharePoint 2016 and SQL Server 2016
What's New for the BI workload in SharePoint 2016 and SQL Server 2016SPC Adriatics
 

Mais de SPC Adriatics (20)

How to secure your data in Office 365
How to secure your data in Office 365 How to secure your data in Office 365
How to secure your data in Office 365
 
Do you know, where your sensitive data is?
Do you know, where your sensitive data is?Do you know, where your sensitive data is?
Do you know, where your sensitive data is?
 
Securing Intellectual Property using Azure Rights Management Services
Securing Intellectual Property using Azure Rights Management ServicesSecuring Intellectual Property using Azure Rights Management Services
Securing Intellectual Property using Azure Rights Management Services
 
Creating Workflows in Project Online
Creating Workflows in Project OnlineCreating Workflows in Project Online
Creating Workflows in Project Online
 
Faster than a flash behind the scenes of patching SharePoint Online
Faster than a flash   behind the scenes of patching SharePoint OnlineFaster than a flash   behind the scenes of patching SharePoint Online
Faster than a flash behind the scenes of patching SharePoint Online
 
Role based views in Project and Resource Center
Role based views in Project and Resource CenterRole based views in Project and Resource Center
Role based views in Project and Resource Center
 
OneDrive, TwoDrive, Whiterive, BlueDrive (hahaha)
OneDrive, TwoDrive, Whiterive, BlueDrive (hahaha)OneDrive, TwoDrive, Whiterive, BlueDrive (hahaha)
OneDrive, TwoDrive, Whiterive, BlueDrive (hahaha)
 
SharePoint Governance and Compliance
SharePoint Governance and ComplianceSharePoint Governance and Compliance
SharePoint Governance and Compliance
 
From analyses to successful Implementation
From analyses to successful ImplementationFrom analyses to successful Implementation
From analyses to successful Implementation
 
The key to a successful Office 365 implementation is adoption
The key to a successful Office 365 implementation is adoptionThe key to a successful Office 365 implementation is adoption
The key to a successful Office 365 implementation is adoption
 
Office 365 Video
Office 365 VideoOffice 365 Video
Office 365 Video
 
10 Steps to be Successful with Enterprise Search
10 Steps to be Successful with Enterprise Search10 Steps to be Successful with Enterprise Search
10 Steps to be Successful with Enterprise Search
 
How the Cloud Changes Business Solution Design and Delivery
How the Cloud Changes Business Solution Design and DeliveryHow the Cloud Changes Business Solution Design and Delivery
How the Cloud Changes Business Solution Design and Delivery
 
Scaling SharePoint 2016 Farms with MinRole & Other Tools
Scaling SharePoint 2016 Farms with MinRole & Other ToolsScaling SharePoint 2016 Farms with MinRole & Other Tools
Scaling SharePoint 2016 Farms with MinRole & Other Tools
 
SharePoint 2013 Search Operations
SharePoint 2013 Search OperationsSharePoint 2013 Search Operations
SharePoint 2013 Search Operations
 
Office Online Server 2016 - a must for on-premises installation for SharePoin...
Office Online Server 2016 - a must for on-premises installation for SharePoin...Office Online Server 2016 - a must for on-premises installation for SharePoin...
Office Online Server 2016 - a must for on-premises installation for SharePoin...
 
Custom Code-The Missing Piece of the SharePoint Governance Puzzle
Custom Code-The Missing Piece of the SharePoint Governance PuzzleCustom Code-The Missing Piece of the SharePoint Governance Puzzle
Custom Code-The Missing Piece of the SharePoint Governance Puzzle
 
SharePoint 2016 Hybrid Sites Inside Out
SharePoint 2016 Hybrid Sites Inside OutSharePoint 2016 Hybrid Sites Inside Out
SharePoint 2016 Hybrid Sites Inside Out
 
Microsoft BI demystified: SharePoint 2016 BI or for PowerBI v2?
Microsoft BI demystified: SharePoint 2016 BI or for PowerBI v2?Microsoft BI demystified: SharePoint 2016 BI or for PowerBI v2?
Microsoft BI demystified: SharePoint 2016 BI or for PowerBI v2?
 
What's New for the BI workload in SharePoint 2016 and SQL Server 2016
What's New for the BI workload in SharePoint 2016 and SQL Server 2016What's New for the BI workload in SharePoint 2016 and SQL Server 2016
What's New for the BI workload in SharePoint 2016 and SQL Server 2016
 

Último

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 

Último (20)

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 

Working with site policies in SharePoint 2013 - Dragan Panjkov

  • 1. Working with site policies in SharePoint 2013 DRAGAN PANJKOV, PLANB. B: WWW.DRAGAN-PANJKOV.COM T: @PANJKOV SHAREPOINT AND PROJECT CONFERENCE ADRIATICS 2013 ZAGREB, NOVEMBER 27-28 2013
  • 3. About • Dragan Panjkov • Working with SharePoint since 2007 • www.dragan-panjkov.com • www.twitter.com/panjkov • PlanB. d.o.o. • www.planb.ba • SharePoint user group • www.1sug.com
  • 4. Agenda • Information Management Policies • Site Policies • Configuration steps needed to enable Site Policies on sites • Creating Site Policies in SharePoint UI • Working with Site Policies using Server OM • Working with Site Policies using Client OM
  • 5. Information management policy? • An information management policy is a set of rules that govern the availability and behavior of a certain type of important content. Policy enables administrators to control and evaluate who can access information, how long to retain information, and how effectively people are complying with the policy.
  • 6. In other words • Information Management Policy connects business need and technical implementation of the solution to ensure that standards are met Business Outcomes Information Classification Functional Preferences Information Architecture Functional Design Information Management Standards Information Management Policies Information Management Architecture Technical Considerations Service Management Policies Service Architecture Project Constraints Budget, Timeframe, Resources
  • 7. Information Management Policy Scopes • List • Library • Content Type • Site
  • 8. Site Retention? • How do we control site lifecycle? • Are we able to track old and unused sites? • Are we able to easily delete old, unused, expired sites?
  • 9. Site Policies • Opportunity to predefine retention rules for sites • Assign retention policy at site creation • Site Policies can be configured that sites are: • Closed and then deleted automatically • Deleted automatically after certain period of time • Marked as read-only • Site Policies can be published in Content Type Hub
  • 10. Enabling Site Policy functionality In UI: • Enable features in Site Collection • Library and Folder Based Retention • Site Policy • Hidden feature “Record Resources” activated automatically In onet.xml <SiteFeatures> <Feature ID="5bccb9a4-b903-4fd1-8620-b795fa33c9ba" Name="RecordResources" /> <Feature ID="063c26fa-3ccc-4180-8a84-b6f98e991df3" Name="LocationBasedPolicy" /> <Feature ID="2fcd5f8a-26b7-4a6a-9755-918566dba90a" Name="ProjectBasedPolicy" /> </SiteFeatures>
  • 11. CREATING AND APPLYING SITE POLICIES IN UI
  • 21. Site Policies in SSOM namespace Microsoft.Office.RecordsManagement.InformationPolicy { public class ProjectPolicy { public string Description { get; internal set; } public string EmailBody { get; set; } public string EmailBodyWithTeamMailbox { get; set; } public string EmailSubject { get; set; } public string Name { get; internal set; } public public public public public public public public public public public } } static void ApplyProjectPolicy(SPWeb web, ProjectPolicy projectPolicy); static void CloseProject(SPWeb web); static bool DoesProjectHavePolicy(SPWeb web); static ProjectPolicy GetCurrentlyAppliedProjectPolicyOnWeb(SPWeb web); static DateTime GetProjectCloseDate(SPWeb web); static DateTime GetProjectExpirationDate(SPWeb web); static List<ProjectPolicy> GetProjectPolicies(SPWeb web); static bool IsProjectClosed(SPWeb web); static void OpenProject(SPWeb web); static void PostponeProject(SPWeb web); void SavePolicy();
  • 23. Create Site Policies // ProjectPolicy Content Type ID SPContentTypeId policyCTID= new SPContentTypeId("0x010085EC78BE64F9478aAE3ED069093B9963"); SPContentTypeCollection contentTypes = site.RootWeb.ContentTypes; // ProjectPolicy is parent content type SPContentType parentContentType = contentTypes[policyCTID]; // we create new content type based on ProjectPolicy policyContentType = new SPContentType(parentContentType, contentTypes, "New Project Policy"); policyContentType = contentTypes.Add(policyContentType); policyContentType.Group = parentContentType.Group; policyContentType.Hidden = true; policyContentType.Update(); // Final step is to create new Policy with new content type Policy.CreatePolicy(policyContentType, null);
  • 24. Read Site Policies that exist on site private static void ReadProjectPolicies() { using (SPSite targetSite = new SPSite(siteUrl)) { SPWeb targetWeb = targetSite.RootWeb; List<ProjectPolicy> projectPolicies = ProjectPolicy.GetProjectPolicies(targetWeb); if (projectPolicies!= null && projectPolicies.Count > 0) { Console.WriteLine("Project Policies on web {0}", siteUrl); foreach (var item in projectPolicies) { Console.WriteLine("Name: {0}",item.Name); Console.WriteLine("Desc: {0}",item.Description); Console.WriteLine(); } } Console.WriteLine(); try { targetWeb.Dispose(); } catch { } } }
  • 25. Get Applied Policy private static void GetAppliedPolicy() { using (SPSite targetSite = new SPSite(siteUrl)) { SPWeb targetWeb = targetSite.RootWeb; ProjectPolicy appliedPolicy = ProjectPolicy.GetCurrentlyAppliedProjectPolicyOnWeb(targetWeb); if (appliedPolicy != null) { Console.WriteLine("Currently applied Project Policy on web {0}", siteUrl); Console.WriteLine(appliedPolicy.Name); Console.WriteLine(appliedPolicy.Description); } else { Console.WriteLine("Project Policy is not applied on web {0}", siteUrl); } Console.WriteLine(); try { targetWeb.Dispose(); } catch { } } }
  • 26. Is Policy Applied? private static void IsPolicyApplied() { using (SPSite targetSite = new SPSite(siteUrl)) { SPWeb targetWeb = targetSite.RootWeb; bool isPolicyApplied = ProjectPolicy.DoesProjectHavePolicy(targetWeb); if (isPolicyApplied) { Console.WriteLine("Web has policy applied {0}", siteUrl); } else { Console.WriteLine("Project Policy is not applied on web {0}", siteUrl); } Console.WriteLine(); try { targetWeb.Dispose(); } catch { } } }
  • 27. Apply Policy private static void ApplyPolicySSOM() { string policyName = "DEVSITE DoNotClose-ReadOnly Policy"; using (SPSite targetSite = new SPSite(siteUrl)) { SPWeb targetWeb = targetSite.RootWeb; List<ProjectPolicy> webPolicies = ProjectPolicy.GetProjectPolicies(targetWeb); ProjectPolicy selectedPolicy = webPolicies.Where(p => p.Name == policyName).FirstOrDefault(); if (selectedPolicy != null) { ProjectPolicy.ApplyProjectPolicy(targetWeb, selectedPolicy); targetWeb.Update(); Console.WriteLine("Successfully applied policy '{0}' on web '{1}'", policyName, targetWeb); } } }
  • 28. Get Project Close and Expiration Date private static void GetProjectCloseExpirationDate() { using (SPSite targetSite = new SPSite(siteUrl)) { SPWeb targetWeb = targetSite.RootWeb; DateTime closedDate = ProjectPolicy.GetProjectCloseDate(targetWeb); DateTime expirationDate = ProjectPolicy.GetProjectExpirationDate(targetWeb); if (closedDate != DateTime.MinValue) { Console.WriteLine("Close Date: {0}", closedDate); } if (expirationDate != DateTime.MinValue) { Console.WriteLine("Expiration Date: {0}", expirationDate); } Console.WriteLine(); try { targetWeb.Dispose(); } catch { } } }
  • 29. Open Closed Site ELEVATED private static void OpenProject() { using (SPSite site = new SPSite(siteUrl)) { SPSecurity.RunWithElevatedPrivileges(delegate { using (SPSite targetSite = new SPSite(siteUrl)) { SPWeb targetWeb = targetSite.RootWeb; bool isClosed = ProjectPolicy.IsProjectClosed(targetWeb); Console.WriteLine("Site is Closed! {0}", siteUrl); if (isClosed) { Console.WriteLine("Trying to open site."); ProjectPolicy.OpenProject(targetWeb); Console.WriteLine("Site is now Open! {0}", siteUrl); } Console.WriteLine(); try { targetWeb.Dispose(); } catch { } } }); } }
  • 30. Site Policies in CSOM namespace Microsoft.SharePoint.Client.InformationPolicy { [ScriptType("SP.InformationPolicy.ProjectPolicy", ServerTypeId = "{ec5e0a70-0cc3-408f-a4dc-1bb3495aac75}")] public class ProjectPolicy : ClientObject { [EditorBrowsable(EditorBrowsableState.Never)] public ProjectPolicy(ClientRuntimeContext context, ObjectPath objectPath); [Remote] public static void ApplyProjectPolicy(ClientRuntimeContext context, Web web, ProjectPolicy projectPolicy); [Remote] public static void CloseProject(ClientRuntimeContext context, Web web); [Remote] public static ClientResult<bool> DoesProjectHavePolicy(ClientRuntimeContext context, Web web); [Remote] public static ProjectPolicy GetCurrentlyAppliedProjectPolicyOnWeb(ClientRuntimeContext context, Web web); [Remote] public static ClientResult<DateTime> GetProjectCloseDate(ClientRuntimeContext context, Web web); [Remote] public static ClientResult<DateTime> GetProjectExpirationDate(ClientRuntimeContext context, Web web); [Remote] public static ClientObjectList<ProjectPolicy> GetProjectPolicies(ClientRuntimeContext context, Web web); protected override bool InitOnePropertyFromJson(string peekedName, JsonReader reader); [Remote] public static ClientResult<bool> IsProjectClosed(ClientRuntimeContext context, Web web); [Remote] public static void OpenProject(ClientRuntimeContext context, Web web); [Remote] public static void PostponeProject(ClientRuntimeContext context, Web web); [Remote] public void SavePolicy(); } }
  • 32. Read Site Policies that exist on site private static void ReadProjectPoliciesCsom() { ClientContext policyContext = new ClientContext(siteUrl); Web targetWeb = policyContext.Web; ClientObjectList<ProjectPolicy> projectPolicies = ProjectPolicy.GetProjectPolicies(policyContext, targetWeb); policyContext.Load(projectPolicies); policyContext.ExecuteQuery(); if (projectPolicies != null && projectPolicies.Count > 0) { Console.WriteLine("Project Policies on web {0}", siteUrl); foreach (var item in projectPolicies) { Console.WriteLine("Name: {0}", item.Name); Console.WriteLine("Desc: {0}", item.Description); Console.WriteLine(); } } Console.WriteLine(); }
  • 33. Get Applied Policy private static void GetAppliedPolicyCsom() { ClientContext policyContext = new ClientContext(siteUrl); Web targetWeb = policyContext.Web; ClientResult<bool> isPolicyApplied = ProjectPolicy.DoesProjectHavePolicy(policyContext, targetWeb); policyContext.ExecuteQuery(); if (isPolicyApplied.Value) { ProjectPolicy appliedPolicy = ProjectPolicy.GetCurrentlyAppliedProjectPolicyOnWeb(policyContext, targetWeb); policyContext.Load(appliedPolicy); policyContext.ExecuteQuery(); if (appliedPolicy.TypedObject.ServerObjectIsNull != true) { Console.WriteLine("Currently applied Project Policy on web {0}", siteUrl); Console.WriteLine(appliedPolicy.Name); Console.WriteLine(appliedPolicy.Description); } } else { Console.WriteLine("Project Policy is not applied on web {0}", siteUrl); } Console.WriteLine(); }
  • 34. Is Policy Applied? private static void IsPolicyAppliedCsom() { ClientContext policyContext = new ClientContext(siteUrl); Web targetWeb = policyContext.Web; ClientResult<bool> isPolicyApplied = ProjectPolicy.DoesProjectHavePolicy(policyContext, targetWeb); policyContext.ExecuteQuery(); if (isPolicyApplied.Value) { Console.WriteLine("Web has policy applied {0}", siteUrl); } else { Console.WriteLine("Project Policy is not applied on web {0}", siteUrl); } Console.WriteLine(); }
  • 35. Apply Policy private static void ApplyPolicyCsom() { string policyName = "DEVSITE DoNotClose-ReadOnly Policy"; ClientContext policyContext = new ClientContext(siteUrl); targetWeb); Web targetWeb = policyContext.Web; ClientObjectCollection<ProjectPolicy> webPolicies = ProjectPolicy.GetProjectPolicies(policyContext, policyContext.Load(webPolicies); policyContext.ExecuteQuery(); ProjectPolicy selectedPolicy = webPolicies.Where(p => p.Name == policyName).FirstOrDefault(); if (selectedPolicy != null) { ProjectPolicy.ApplyProjectPolicy(policyContext, targetWeb, selectedPolicy); policyContext.ExecuteQuery(); Console.WriteLine("Successfully applied policy '{0}' on web '{1}'", policyName, siteUrl); } Console.WriteLine(); }
  • 36. Get Project Close and Expiration Date private static void GetProjectCloseExpirationDateCsom() { ClientContext policyContext = new ClientContext(siteUrl); Web targetWeb = policyContext.Web; ClientResult<DateTime> closedDate = ProjectPolicy.GetProjectCloseDate(policyContext, targetWeb); ClientResult<DateTime> expirationDate = ProjectPolicy.GetProjectExpirationDate(policyContext, targetWeb); policyContext.ExecuteQuery(); if (closedDate.Value != DateTime.MinValue) { Console.WriteLine("Close Date: {0}", closedDate.Value); } if (expirationDate.Value != DateTime.MinValue) { Console.WriteLine("Expiration Date: {0}", expirationDate.Value); } Console.WriteLine(); }
  • 37. Close Site private static void CloseProjectCsom() { ClientContext policyContext = new ClientContext(siteUrl); Web targetWeb = policyContext.Web; ClientResult<bool> isClosed = ProjectPolicy.IsProjectClosed(policyContext, targetWeb); policyContext.ExecuteQuery(); if (!isClosed.Value) { ProjectPolicy.CloseProject(policyContext, targetWeb); } policyContext.ExecuteQuery(); isClosed = ProjectPolicy.IsProjectClosed(policyContext, targetWeb); policyContext.ExecuteQuery(); if (isClosed.Value) { Console.WriteLine("Project is closed! {0}", siteUrl); } else { Console.WriteLine("Project is NOT closed!"); } Console.WriteLine(); }
  • 38. Resources • http://msdn.microsoft.com/enus/library/microsoft.office.recordsmanagement.informationpolicy.proj ectpolicy_members.aspx • http://technet.microsoft.com/en-us/library/jj219569.aspx • http://blog.dragan-panjkov.com/archive/2013/06/30/creating-sitepolicy-in-sharepoint-2013-using-server-code.aspx • http://blog.dragan-panjkov.com/archive/2013/10/27/configuring-sitepolicy-in-sharepoint-2013-using-server-code.aspx • http://blogs.technet.com/b/tothesharepoint/archive/2013/03/28/sitepolicy-in-sharepoint.aspx • http://stevemannspath.blogspot.com/2012/08/sharepoint-2013-siteretention-getting.html • http://www.booden.net/ProjectPolicy.aspx
  • 40. thank you. SHAREPOINT AND PROJECT CONFERENCE ADRIATICS 2013 ZAGREB, NOVEMBER 27-28 2013