Accessing AllProperties collection from javascript
-
2012년 4월 23일 월요일 오후 8:50
I'm trying to figure out how to access a web sites custom properties. I know how to do this with the client object model from silverlight but it seems to be a little different from javascript. I assume I have to access the property on the onQuerySucceeded event handler but not sure how to format it.
<script> ExecuteOrDelayUntilScriptLoaded(retrieveSpecificWebProperties, "sp.js"); function retrieveSpecificWebProperties() { var clientContext = SP.ClientContext.get_current(); web= clientContext.get_web(); clientContext.load(web); cwebContext.executeQueryAsync(onQuerySucceeded, onQueryFailed); } function onQuerySucceeded(sender, args) { alert(web.allproperties['myproperty']);} function onQueryFailed(sender, args) { alert('failed');}</script>
모든 응답
-
2012년 4월 24일 화요일 오전 5:31
clientContext.load(web); will load all the properties . if you want to use properties then use after this statement.
Check this article
http://ranaictiu-technicalblog.blogspot.in/2010/02/sharepoint-2010-managed-net-client-with.html
Regards,Milan Chauhan- 답변으로 표시됨 Shimin Huang 2012년 5월 4일 금요일 오전 7:32
- 답변으로 표시 취소됨 Beruken 2012년 5월 4일 금요일 오후 12:09
-
2012년 5월 4일 금요일 오후 1:52
Unfortunately, your solution is not the case. My question was not a c# client solution but a javascript JSOM. The notation is a little different as well as the approach. I am able to connect to my web object and access built in properties but the "CUSTOM" properties are what I am having an issue with. If I apply some examples I found on the web I would take the approach as shown.
values = Context.get_web().get_allProperties();
Context.load(values);
Context.executeQueryAsync(Function.createDelegate(this, this.OnPropSucceeded), Function.createDelegate(this, this.onFailed));function onPropSucceeded(sender, args){ alert(values.get_item("MSPWAPROJUID"));}
However, it just doesn't work for various reasons. Any idea why or how to accomplish this?
Thanks.

