Hello,
I am using SPService to get the current user office name in Office365 but it is not working as expected.
The code is as below…
<script src=”/SiteAssets/jquery-1.3.2.min.js” type=”text/javascript”></script>
<script type=”text/javascript” src=”//cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/2014.02/jquery.SPServices.min.js”></script>
<script type=”text/javascript”>
$(document).ready(function(){
var thisUser = $().SPServices.SPGetCurrentUser();
alert(thisUser);
var userOffice = $().SPServices.SPGetCurrentUser({
fieldName: “Office”,
debug: false
});
alert(userOffice);
});
</script>
Help Me Out ……
Thanks in Advance…
Please console your application and check what exactly error message is? Troubleshooting error in illusion won’t work.
Thanks Sir….Â
I used both scripts(Updated one also) but in this scenario they have same effect.
I not understood that I write the same script as Amir Reza Sir write than what was the problem?
My first suggestion is to use a recent version of jQuery. You’re about 5 years behind.
M.
Its all depend on Sync policy what you adopted. It may or may not check your policy.Â
For your previous question check your console what is error? after page load click f12 and check console. with alert you can also add console.log(thisUserOffice).
<script type="text/javascript">
var thisUserOffice ;
$(document).ready(function() {
thisUserOffice
= $().SPServices.SPGetCurrentUser({
webURL: "", //URL of the target Site Collection. If not specified, the //current Web is used. (Optional)
fieldName: "Office",
debug: false
});
alert(
thisUserOffice);
});
</script>
Better if come with error message it will be easy to troubleshoot.