Suppose you have created a job and scoped to multiple web application.. the job should be smart enough to pick up the correct setting you may have added in the config file.. below is the code to get it..
// get the settings
System.Configuration.Configuration myConfig;
//myConfig = WebConfigurationManager.OpenWebConfiguration("/", "SharePoint_500");
myConfig = WebConfigurationManager.OpenWebConfiguration("/", this.WebApplication.Name);
if (!myConfig.Equals(null))
{
this.connStrFromAppSettings = myConfig.AppSettings.Settings["ConnectionString"].Value;
this.CUSTOM_SITE_TEMPLATE_NAME = myConfig.AppSettings.Settings["CustomSiteTemplateName"].Value;
this.SITECOLLECTION_URL = myConfig.AppSettings.Settings["SiteCollectionURL"].Value;
this.BUFFER_SIZE = Convert.ToInt32(myConfig.AppSettings.Settings["BufferSize"].Value);
}
sharepoint calendar sharing - sharepoint global calendar
Recently, working with one of our clients who wanted a single calendar at the root site, to be shared among multiple sub-sites,with some filter.
Download:
Download entire code
here
Ref:
///
/// Set Unique permissions to document Library
///
///
///
/// possible values 'Full Control', 'Read', 'Contribute'
public static void SetDocLibPermissions(SPWeb spWeb, SPGroup grpToGrantPermission, string roleDefinitionName)
{
string docLibName = "MyDocumentLib";
SPList MyDocLibrary = spWeb.Lists[docLibName];
if (MyDocLibrary != null)
{
MyDocLibrary.BreakRoleInheritance(false);
if (roleDefinitionName != null)
{
SPRoleAssignment roleAssignment = new SPRoleAssignment(grpToGrantPermission);
SPRoleDefinition roleDefinition = spWeb.RoleDefinitions[roleDefinitionName];
roleAssignment.RoleDefinitionBindings.Add(roleDefinition);
MyDocLibrary.RoleAssignments.Add(roleAssignment);
MyDocLibrary.Update();
}
}
}