How do I query the Exchange Online REST API for a list of users, mailboxes and/or calendars? - rest

Background
I'm able to query outlook.office365.com/api/v1.0/me/ for the current user that is logged in. But I'm unable to find a query that would give me a list of users. Below are the following queries I've tried without any luck.
outlook.office365.com/api/v1.0/users/
outlook.office365.com/api/v1.0/me/users/
This is the error I receive when I'm doing either of the queries.
https://www.dropbox.com/s/64o0mwj1w3uigk8/Screenshot%202015-07-09%2013.07.22.png?dl=0
Goal
I would like help finding the correct REST API queries for a list of users, mailboxes, and calendars.
Extra Findings
Note that while I was referring to https://msdn.microsoft.com/en-us/office/office365/api/complex-types-for-mail-contacts-calendar#RESTAPIResourcesUser I received the error listed above for the query'../me/users/$count' when trying to count the number of users.

We don't allow enumerating the list of users in a tenant using the outlook endpoint. you can however do this using the AAD graph api. For example:
https://graph.windows.net/contoso.com/users?api-version=2013-04-05
For calendars, you can see all calendars of a given user by enumerating those from ../me/calendars
Thanks for mentioning the $count issue, it was a bug which has been fixed. You should see it rolled out soon worldwide. But note that this will still not allow you to get a count of users as that collection is not enumerable. The $count will help with queries like ../me/messages/$count

Related

Checking if a user is a member of a specific facebook group (2016)

It appears there was a big update to the facebook api a year ago and a lot of the info online is inaccurate because of it. I'm trying to create a website that provides additional function for members of a specific facebook group; if a user is not part of a specific group I don't want them in it. Some groups may have more than 5k users but if I have to settle for less, so be it. I'm using the php sdk and have successfully made an initial api call with general user information.
Administrators of the group WILL be able to log in, but apparently Facebook isn't approving the "user_groups" permission (?) https://stackoverflow.com/questions/31171082/check-if-user-is-a-member-of-a-specific-group-using-facebooks-javascript-sdk
I found this but I'm not sure how to make it work. Facebook Graph - Possible To Check If A User Is A Member Of A Group w/o user_groups?
I'm using the graph api explorer and I can get a partial list of the groups I'm in but it's nowhere near complete (it displays 4 out of like 20). My thought was that if I can get a full list of members in a group that I could just do an [if user is in userlist then]
What would you do here?
As far as I understand there is no way to do this without some caveat where it won't work (when you have more then 5k members). It also causes you to create a copy of the members list, instead of when a user wants to access the group.

AD Azure Graph API does not return directorylinkchanges

I am using differential query feature provided by AD Azure graph apis as described here
Things are working fine except for one issue. The sample responses in the link show that membership changes are sent across as directorylinkchange objects but I do not receive any such objects with similar queries on making membership changes from the portal.
I am doing a GET to
https://graph.windows.net/<domain-name>/directoryObjects?api-version=2013-04-05&$filter=isof('Microsoft.WindowsAzure.ActiveDirectory.Group')%20or%20isof('Microsoft.WindowsAzure.ActiveDirectory.User')&deltaLink=cLbsN4TzLm92uH26XEe7Ph6HfE10VkRsxjmz8 ..[truncated]
I am not sure if I am missing something here as I am able to fetch other User and Group changes. So could anyone working on azure be able help me out on this one. Thanks !!
Ok. answer to my own question is , that the URL filter must contain all three object classes User, Group and Contact just like it is in the microsoft sample.
https://graph.windows.net/contoso.com/directoryObjects?api-version=2013-04-05&$filter=isof('Microsoft.WindowsAzure.ActiveDirectory.User')%20or%20isof('Microsoft.WindowsAzure.ActiveDirectory.Group')%20or%20isof('Microsoft.WindowsAzure.ActiveDirectory.Contact')

Remove all ratings from a SharePoint 2010 document library

I have a SharePoint 2010 document library in which I have enabled ratings. During testing, several people rated a number of documents, and now I'd like to reset all the documents back to zero. However, I cannot find a way to reset the ratings.
Things I've tried:
Disable ratings and re-enable: The ratings are still there.
Disable ratings, wait 24 hours, and re-enable ratings: The ratings are still there.
Using PowerShell and the SocialRatingManager, attempt to reset the rating (http://www.sharemuch.com/2011/03/22/resetting-sharepoint-2010-social-rating-using-powershell/): The script runs, but nothing changes.
Using the script above, modified to try to do a Delete() method on the rating result: "Attempted to perform an unauthorized operation", even though I am running the SharePoint Powershell as Administrator, logged in as a site admin.
It seems like the last option should be the one to work, but I can't seem to get access to delete someone else's social ratings. Any input would be appreciated.
Social tag manager errors/not workings are usually related to rights, here is a very good guide how to resolve the issues
http://www.sharepointpals.com/post/Programmatically-Manage-List-Items-Rating-with-Social-Rating-Manager-in-SharePoint-2013

How can I delete a group of posts that my app created?

My app sent out a batch of posts tonight that were created erroneously. I would like to delete them, but I don't currently store the ids of posts that I create.
Is there a way to query for posts made after a certain time?
Once I have the ids I think I know how to delete them.
I'm using the Ruby gems facebooker2 and mogli.
You can retrieve the posts from feed or home connection of user.
For using those connections to read users post you will need read_stream permissions from user (which may be a bit problematic in your case if you not yet have this permission granted) and active access_token (this one will be needed to remove the posts too).
feed connection can be easily parsed to get posts from your application (since every post object have application property containing name and id)
home connection contain much more details to parse but you can filter results by application using filter (like /USER_ID/home/filter=app_2305272732).
Once you discovered the posts you may delete 'em by issuing DELETE request to Graph API:
DELETE https://graph.facebook.com/POST_ID?access_token=...
Or several posts for same user:
DELETE https://graph.facebook.com/?ids=POST_ID_1,POST_ID_2,POST_ID_N?access_token=...
Notes:
Since you said you didn't stored ids of post that published, more problematic may be discovering the list of users who got posted.

Using GA Data Export API to Get All UA's

I am using the GA Data Export API to interact with Google Analytics and I'm making a lot of progress, I am using this URL Endpoint initially to pull all the profiles under an account:
https://www.google.com/analytics/feeds/accounts/default
This URL retrieves each GA ID (profile) and each UA. One thing I've realized is one account can contain multiple UAs and when this happens, this request pulls all profiles. We have a client who has about 115 profiles under like 10 different UAs, and the request takes about 30 seconds for the initial request (and then I believe it must be cached, because it speeds up considerably after this, but then the next day the same thing occurs).
Is there a way to get a list of UA's without pulling the profiles? This way I can query the UA specifically for the profiles instead of pulling each one.
Any advice on this would be really helpful!
Thanks
UPDATE: Here's some documentation on the specific call I am using right now:
http://code.google.com/apis/analytics/docs/gdata/gdataReferenceAccountFeed.html
UPDATE 1: I have found some interesting information in the docs
Once your application has verified
that the user has Analytics access,
its next step is to find out which
Analytics accounts the user has access
to. Remember, users can have access to
many different accounts, and within
them, many different profiles. For
this reason, your application cannot
access any report information without
first requesting the list of accounts
available to the user. The resulting
accounts feed returns that list, but
most importantly, the list also
contains the account profiles that the
user can view.
So this means that you have to use the default accounts call to get these back? Surely, somebody has had this issue before?
So apparently, you can query the account if you know the UA-ID, however there is no way to get back a list of only UA IDs.
One way you can do it is have the user enter their own UA ID instead of having them choose one; not as user-friendly as it could be but better than making the user wait 30 seconds!