Created
July 27, 2015 11:25
-
-
Save asadrefai/9a77e936cf4b5fc45df7 to your computer and use it in GitHub Desktop.
Get Content Organizer Rule using CSOM c#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Security; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Microsoft.SharePoint.Client; | |
namespace RecordCentreRule | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var targetSite = new Uri("https://YourSite.sharepoint.com"); | |
var login = "SomeOne@SharePoint.onmicrosoft.com"; | |
var password = "YourPassword"; | |
var securePassword = new SecureString(); | |
foreach (char c in password) | |
{ | |
securePassword.AppendChar(c); | |
} | |
var onlineCredentials = new SharePointOnlineCredentials(login, securePassword); | |
using (ClientContext clientCtx = new ClientContext(targetSite)) | |
{ | |
clientCtx.Credentials = onlineCredentials; | |
Web web = clientCtx.Web; | |
List routingRulesList = web.Lists.GetByTitle("Content Organizer Rules"); | |
ListItem itm = routingRulesList.GetItemById(1); | |
clientCtx.Load(web); | |
clientCtx.Load(routingRulesList); | |
clientCtx.Load(itm); | |
clientCtx.ExecuteQuery(); | |
Console.WriteLine("Title: " + itm["Title"] + "\n"); | |
Console.WriteLine("RoutingConditions: " + itm["RoutingConditions"] + "\n"); | |
Console.WriteLine("RoutingConditionProperties: " + itm["RoutingConditionProperties"] + "\n"); | |
Console.WriteLine("RoutingContentType: " + itm["RoutingContentType"] + "\n"); | |
Console.WriteLine("RoutingContentTypeInternal: " + itm["RoutingContentTypeInternal"] + "\n"); | |
Console.WriteLine("RoutingConditions: " + itm["RoutingConditions"] + "\n"); | |
Console.WriteLine("RoutingConditionProperties: " + itm["RoutingConditionProperties"] + "\n"); | |
Console.WriteLine("RoutingAliases: " + itm["RoutingAliases"] + "\n"); | |
Console.WriteLine("RoutingTargetLibrary: " + itm["RoutingTargetLibrary"] + "\n"); | |
Console.WriteLine("RoutingTargetFolder: " + itm["RoutingTargetFolder"] + "\n"); | |
Console.WriteLine("RoutingTargetPath: " + itm["RoutingTargetPath"] + "\n"); | |
Console.WriteLine("RoutingAutoFolderProp: " + itm["RoutingAutoFolderProp"] + "\n"); | |
Console.WriteLine("RoutingAutoFolderSettings: " + itm["RoutingAutoFolderSettings"] + "\n"); | |
Console.WriteLine("RoutingCustomRouter: " + itm["RoutingCustomRouter"] + "\n"); | |
Console.WriteLine("RoutingRuleExternal: " + itm["RoutingRuleExternal"] + "\n"); | |
Console.Read(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment