On April 27, 2024, our Sign-in and Create Account options will be unavailable from 9am-12pm ET. During this maintenance window, developer account access and free trial registration will be unavailable.

Automate the creation of archiving rules

Hi,

 

Im trying to automate via the API the creation of Archiving rules. through alot of digging arround i've manaed to get this far

Microsoft.SharePoint.Administration.SPAdministrationWebApplication centralWeb = SPAdministrationWebApplication.Local;

string webAppUrl = centralWeb.Sites[0].Url;

using (SPSite site = new SPSite(webAppUrl/*TODO: change the url*/))

{

using (SPWeb rootWeb = site.RootWeb)

{

IConfigurationReader configurationReader = new SPConfigurationReader(rootWeb);

LivelinkConfigurationProvider configurationProvider = new LivelinkConfigurationProvider(configurationReader);

ProfileConfig profileConfig = configurationProvider.ProfileConfig;

Profile p = new Profile();

Opentext.SharePoint.Livelink.Profiles.Rule rul = new Opentext.SharePoint.Livelink.Profiles.Rule();

rul.Action = Opentext.SharePoint.Livelink.Configuration.Common.FileArchivingActionType.SyncedCopyAction;

Object obj = new object();

ArchivingFolder archfoflder = new ArchivingFolder("CS10Dev", -2000, 363613, "363613", "AGA Test", obj);

Settings set = new Settings(Opentext.SharePoint.Configuration.Common.IncludedVersionsType.All, archfoflder);

rul.Settings = set;

LLNode node = new LLNode("CS10Dev", -97926, 585326);

LLNamedNode llnode = new LLNamedNode(node, "585326", "Routine Enquiries");

rul.RMClassification = llnode;

Query query = new Query("test", "<Eq><FieldRef Name='File_x0020_Plan_x0020_No'/><Value Type='Lookup'>1/5/2/1 Budget Speech</Value></Eq>", true, true);

rul.Query = query;

 

profileConfig.Profiles[0].AddRule();

}

}

When i run it and step through i can see that i am in fact openeing the correct profile. i dont get any errors but the rule is not added. am i missing something?

 

thanks in advance