Domanda

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;
    }
È stato utile?

Soluzione

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/

Altri suggerimenti

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();

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top