Go back to index
How to add policy for a user in web application
Following code block explains how to programmatically add an user policy in a web application.
using System;
using SPTool.Library;
using System.Collections;
namespace SPTool.Test
{
class Program
{
static void Main(string[] args)
{
SPTWebApplication webApplication = new SPTWebApplication("http://sptool/");
// Add Policy for User
SPTReturn returnObj = webApplication.AddPolicyForUser(@"Domain/TestUser", new ArrayList(new string[]{"SPTool Permissions"}));
// Check the status of adding policy
if (returnObj.State == SPTState.Success)
{
// Adding Policy Successful
}
else
{
// Adding Policy Failed
}
}
}
}
Go back to index