20

#------------------------Code-------------------------------- $url= Read-Host 'Enter the site Name' $site = New-Object Microsoft.SharePoint.SPSite($url) $rootWeb = $site.RootWeb Write-Host -foregroundcolor Green "The current Site"$rootWeb $value= Read-Host 'Enter the property name' $Adminurl = "propertyName" $rootWeb.AllowUnsafeUpdates = $true; $...


12

Works for me with a couple small changes. Instead of manipulating the FieldValues object, just manipulate the AllProperties object directly. Also, set the value to a string, not an int: web.AllProperties["allowdesigner"] = "0"; Here's the full helper method I use: public static void AddWebProperty(ClientContext ctx, string propertyName, string ...


7

Derek's answer solves problem for property bag in general, but there's also Site.AllowDesigner property you could use for your specific case.


6

You need to use it as below in typescript: pnp.Web(this.url).select("Title", "AllProperties").expand("AllProperties").get().then(r =>{ console.log(r); }); So pure javascript would be as below: $pnp.sp.web.select("AllProperties").expand("AllProperties").get().then(function(result){ // Select the AllProperties from the result console....


6

Share-Point property bags provide an easy-to-use storage mechanism for any serializable configuration data. Below is the sample code: SPWeb web = SPContext.Current.Site.RootWeb; //To store data in property bag web.Properties["TestKey"]="TestData"; //To retrieve data stored in property bag if (web.Properties.ContainsKey("TestKey")) { ...


3

You should be able to do something like the following: var properties = webProperties.get_fieldValues(); // loop over all properties for (property in properties) { var propertyName = property; var propertyValue = properties[property]; console.log(propertyName + " - " + propertyValue); }


3

Property bag is basically properties attached on web site ,site collection , web application and farm level. You can check out the codeplex tool here for more understanding - http://pbs2010.codeplex.com/ You also have a list of cmdlets from Powershell for property bag - http://collab.rdacorp.com/2010/05/sharepoint-2010-property-bag-cmdlet.html


2

To interact with the PropertyBags in code you simply refer to the object's Propeties member. There are PropertyBags available for the SPFarm, SPWebApplication, SPSite, and SPWeb. To set a value: site.Properties["PropertyName"] = "foo"; To read a value: string myProperty= site.Properties["PropertyName"].ToString();


2

Once you have created a Managed property and made it searchable. Run full crawl. Create a managed property for the crawled property created for this property bag.Make the managed property searchable and retrievable. Use it in query just like any other normal managed property. for eg: Prop:Value


2

Try adding properties by doing the following: var spContext = SharePointContextProvider.Current.GetSharePointContext(Context); var clientContext = spContext.CreateUserClientContextForSPHost(); var ConfigDataString=TextBox1.Text; var web = clientContext.Web; web.AllProperties["Config"] = ConfigDataString; web.Update(); clientContext.ExecuteQuery(); This was ...


1

To add values to property bag, try the below code: Web web = context.Site.RootWeb; //change as per your web object context.Load(web, w=>web.AllProperties); context.ExecuteQuery(); var allProperties = web.AllProperties; allProperties["Config"] = "some value"; web.Update(); context.ExecuteQuery(); To retrieve the value, you need to use below code: ...


1

Based on the your comments and my investigation, it looks like there is some issue with the PnP code. Use it as below: public void UpdateMetadata(ClientContext clientContext, string key) { var props = clientContext.Web.AllProperties; clientContext.Load(props); clientContext.ExecuteQuery(); // Confirm that property bag values are indexed by ...


1

There is no AddIndexedPropertyBagKey method in CSOM. Add your property as per normal (Web.AllProperties.FieldValues.Add()) and then add it to the base64 encoded property vti_indexedpropertykeys. Vesa Juvonen has methods here.


1

This is likely because the trim duplicates option is enabled, trimming away similar results. Try unchecking this option.


1

You can store any value of any type in property bags, as long as it is serialized. Having said that all custom objects needs to be serialized. As far as simple key,value stuff, you are pretty much on right track. Think it over using Farm level property, do you really need to save these settings on configuration db level?


1

We are not able to access site property bag values with all default workflow actions in SharePoint Designer. But you may consider following workaround. 1.Export the properties to a list on the same web site with custom code, so that we can access the properties by accessing the data from a list. 2.Create a custom workflow activity. Refer to ...


Only top voted, non community-wiki answers of a minimum length are eligible