This repository was archived by the owner on Jan 18, 2021. It is now read-only.
This repository was archived by the owner on Jan 18, 2021. It is now read-only.
not able to pass site url for "User Methods" #8
Closed
Description
Hello,
I looked into the source code too but I did not find a way to pass the site url for "User Methods". I usually complete the application (js, css, html) locally and then when everything is fine I upload the package to sharepoint folder then users can access the .aspx pages (changed extension from html to aspx) So I always use the complete sharepoint site url.
So if you can set global var for the baseUrl for all functions or at least for the User Methods then it will be much more useful.
Currently I use the original Ajax call for all the projects
function currentLogin() {
$.ajax({
url: "xxxx/teams/apmt/_api/SP.UserProfiles.PeopleManager/GetMyProperties?$select=DisplayName,Email",
async: false,
type: 'get',
headers: {
"Accept": "application/json;odata=verbose"
},
cache: false,
//dataType: 'json',
success: function(spJsonData) {
//get user name
var pageDisplayName;
var displayName = spJsonData.d.DisplayName
var isLongerDisplayName = displayName.search(/[(]/)
if (isLongerDisplayName != -1) {
var bracketStart = displayName.indexOf("(")
pageDisplayName = displayName.substring(0, bracketStart)
} else(pageDisplayName = spJsonData.d.DisplayName)
var loginMsg = "Welcome " + pageDisplayName
$("#login-name").html(loginMsg)
//get user mail id
$("#userMail").html(spJsonData.d.Email)
var picURL = "url(https://outlook.office365.com/owa/service.svc/s/GetPersonaPhoto?email=" + spJsonData.d.Email + ")"
$("#login-image").css("background-image", picURL)
},
error: function() {
$("#login-name").html("Welcome ,[...]")
}
});
}