lundi 1 décembre 2014

Set/get custom property bag values in SharePoint-hosted app



I'm trying to set and get a custom property bag values in my app (not on host) between two pages.


Code:



var context = new SP.ClientContext.get_current();
var web = context.get_site().get_rootWeb();
this.props = web.get_allProperties();
this.props.set_item('Test', 'testvalue')
context.load(web);

context.executeQueryAsync(function () {
console.log("Property saved: " + this.props.get_item('Test'));
},
function (sender, args) {
console.log(args.get_message());
}
);


I've two pages in my app, Default.aspx and Products.aspx. I'm trying to set this property in Products.aspx and then be able to retrieve it in Default.aspx. But I get an error saying: "Access denied, you don't have permissions to perform this action or access this resource" when I'm trying to set it on Products.aspx.








0 commentaires:

Enregistrer un commentaire