Skip to content
This repository has been archived by the owner on Jan 18, 2021. It is now read-only.

site url cannot be called in user() method after introduction of "sprLib.baseUrl()" #31

Closed
YakQin opened this issue Jul 16, 2018 · 2 comments
Assignees
Labels
Milestone

Comments

@YakQin
Copy link

YakQin commented Jul 16, 2018

Hello,

in issue# 8 (#8) we discussed to add the site url to the user methods, and It work at that time but it seems this is no long working after you introduced the "sprLib.baseUrl()"

error from console:
Warning: Check your options! Available user() options are: id,email,login,title

var siteUrl = 'https://xxx.sharepoint.com/teams/xxx'
sprLib.user({
	baseUrl: siteUrl
}).info().then(function (objUser) {
	console.log(objUser)
});

however this is working

sprLib.baseUrl('https://xxx.sharepoint.com/teams/xxxx');
sprLib.user().info().then(function (objUser) {
	console.log(objUser)
});
gitbrent added a commit that referenced this issue Jul 25, 2018
Previous checkins with _url* fixed this as well.
gitbrent added a commit that referenced this issue Jul 25, 2018
@gitbrent gitbrent self-assigned this Jul 25, 2018
@gitbrent gitbrent added the bug label Jul 25, 2018
@gitbrent gitbrent added this to the 1.8.0 milestone Jul 25, 2018
@gitbrent
Copy link
Owner

Thanks @YakQin .

Option parsing and message updated:

sprLib.user({ junk:'test' }).info().then(obj => console.log(obj))

Result:
"Warning: Unknown option(s) passed. Available user() options are: baseUrl,id,email,login,title"

The baseUrl option is honored now:

sprLib.user({ baseUrl:'/issue31' }).groups().then(obj => console.log(obj))

Result: (same outcome when a full URL is used)

DEMO_SpRestLib.aspx:1 Uncaught (in promise) (404) 
URL used: /issue31/_api/Web/CurrentUser?$select=Groups/Id[...]

@YakQin
Copy link
Author

YakQin commented Aug 6, 2018

@gitbrent , thanks a lot for the quick fix. I downloaded the latest version and it worked.

@YakQin YakQin closed this as completed Aug 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants