0

I decompiled Microsofts 'CRM 2015 List Component' sandbox solution because I have some strange issues with it and I noticed that it contains tracing code/logic (which can help me to pinpoint the issue). It can trace/log messages to a SharePoint List which I have to create and add the right columns etc. But to enable tracing and setting the minimum trace level, it reads properties on the root web (see code example below to get the trace level).

My question is: How can I set properties like this via the SharePoint User Interface (i.e. Website >> Settings or Central Administration)? Where are these located? Or can they only be set via PowerShell or something? If so, can you provide a small example or link to point me in the right direction?

 private static TraceLevel GetTraceLevelSetting()
    {
        TraceLevel traceLevel;
        object property = SPContext.get_Current().get_Site().get_RootWeb().GetProperty("TraceLevelForCRMListComponent_4FB367FBA16E481eB56F5788EEB27E5C");
        if (property != null)
        {
            try
            {
                TraceLevel traceLevel1 = (TraceLevel)Enum.Parse(typeof(TraceLevel), property.ToString(), true);
                traceLevel = traceLevel1;
            }
            catch (Exception exception)
            {
                return TraceLevel.Off;
            }
            return traceLevel;
        }
        return TraceLevel.Off;
    }

3 Answers 3

1

There's a handy CodePlex project which provides a feature you can install to manage the Property Bag from Site Settings.

https://pbs2010.codeplex.com/

2

You cannot set site/web properties directly from UI. Best way to do that is use PowerShell:

#Get the web you want:
$web = Get-SPWeb http://spwebsite/sites/site
#Set an existing property:
$web.AllProperties["Key"] = "Value"
#Add a new property"
$web.AllProperties.Add("Key", "Value")
#Update SPWeb object to save the properties:
$web.Update();
3
  • 1
    You don't need to use Add method. Indexer will create new property for you if it doesn't exist. Oct 8, 2015 at 10:24
  • Good to know. Thanks. I tend to use "Add" since that makes code more clear. Oct 8, 2015 at 10:31
  • Hi @PaulStrupeikis, you were the first to answer my question, but I find the mentioned CodePlex solution the most user friendly and that's why I choose that answer. Hope you don't mind. Thank you so much for taking the time to answer. I really appreciate it. Oct 9, 2015 at 14:04
1

SharePoint Designer 2013 has a Site Options button in the top ribbon which will let you create/set these properties. I think it was there for SharePoint Designer 2010 too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.