How to retrieve shared notebooks using the MS Graph API (beta endpoint) - onenote

According to OneNote in the Microsoft Graph API (in Preview) it should be possible to retrieve and access notebooks owned by the user and shared by other users (plus O365 group notebooks).
However, executing https://graph.microsoft.com/beta/me/notes/notebooks just returns my (owned) notebooks (not the shared ones). So maybe I'm doing something wrong here, but how do I list all notebooks that my user has access to (owned as well as shared) using the Graph API?

Sorry for the confusion, OliverL. We've updated the blog post to clarify that the /me endpoint currently only provides access to the OneNote content that’s owned by the current user.
Soon the /me endpoint will also include OneNote content that others have shared with the current user, and then you'll be able to get a list of shared notebooks. But right now, you can only use the /users/<id> or /users/<userPrincipalName> endpoint to access content that another user (specified in the URL) has shared with the current user.
We'll announce the upcoming change in the OneNote Dev Blog when we release it, and make note of it here too. Thanks for your feedback!

Related

Simple Esri/ArcGIS Online connection using a link or iframe

I was asked by a potential client if I can have my software interact with Esri/ArcGIS Online.
Use case: users is logged into SomeRandomSoftwareApp and is looking at a Widget, this Widget includes an Esri asset id, the user clicks a link that passes that ID to Esri/ArcGIS Online and behind the scenes the user is logged into Esri and they see the data associated with the Esri/ArcGIS Online.
Thanks, Keith
If I understand correctly, you have two options for this: API Keys or Application Credentials.
The first one, is a permanent token generated by the owner of the data that will allow the application easy access to it. This is still in beta, and it was not ready for use the last time I check some time ago.
The second one, the owner of the data will generate credentials for your application. With this credentials you will have to request a token each time you want to access the data, all this via OAuth 2.0.
Check the docs for more details ArcGIS Services - Security

Access onenote content

My use case is to integrate onenote in our application. I am using document mentioned at https://msdn.microsoft.com/en-us/office/office365/howto/onenote-copy.
To get notebooks some url's are mentioned like -
Construct the request URI
To construct the request URI, start with the service root URL for your platform:
Notebooks on OneDrive for Business
/me/notes/
/users/{id}/notes/
SharePoint site notebooks
/myOrganization/siteCollections/{id}/sites/{id}/notes/
Unified group notebooks
/myOrganization/groups/{id}/notes/
Out of which I am able to successfully access https://www.onenote.com/api/v1.0/me/notes/.
What about id's in other api's. From where I can get groupId or userId of user who has shared content. Can anyone share link for documentation which mention details about all these things.
Any leads would be appreciated.
For retrieving shared OneNote content, you can use the GetRecentNotebooks API (https://blogs.msdn.microsoft.com/onenotedev/2017/04/21/get-recent-notebooks-api/) or /me/notes/notebooks?includesharednotebooks=true

How does OneNote differ between "View Notebooks" and "View Notebooks in Your Org"?

I'm creating an application to work with OneNote in Office 365 and so I'm creating an app registration in Azure. I want to be able to view notebooks, and there are two permission options: View notebooks and View notebooks in your organization. Irrespective of which permission I select, the only notebooks the call returns are ones in the currently authenticated user's personal site (using "https://www.onenote.com/api/v1.0/me/notes/notebooks" as the Url for the GET request).
So...is it because of the Url I'm using (I haven't found any documentation that uses anything other than ".../me/..."), or is it just working as expected? For example, there's no documentation I've found that describes what all notebooks "in your organization" means - does that include every SharePoint site collection Notebook? Something else? Any additional details or links to specific information would be appreciated.
Yes it is possible to Get Personal Notebooks in the Users OneDrive For Business (/me/) as well as Notebooks hosted in SharePoint sites(/myorganization/) that the user has access to.
Organization Notebooks -
https://www.onenote.com/api/{version}/myorganization/siteCollections/{id}/sites/{id}/notes/notebooks
You would need SiteCollectionId and SiteId to access the organization notebooks.
To understand how you get the notebooks (in the users organization) by referring to this documentation -
https://blogs.msdn.microsoft.com/onenotedev/2015/06/11/and-sharepoint-makes-three/
I did finally find the documentation where they list the different locations from which you can request notebooks: https://msdn.microsoft.com/en-us/office/office365/howto/onenote-get-content. Also, to get the gist of my question, although the service uses a common Url to access notebooks, there isn't a single location where you can ask for all notebooks in an organization. The Azure permission merely gives you the right to go get them if you can find them. As noted in the first answer above, if you know where they are at and if you have the right permissions with your app then that all works great. But you have to know where they are, because there doesn't seem to be a discovery type API for them.

Using Actions on Google and Google Drive together?

I'm a hobbyist student developer playing around with the Actions on Google to create a simple "text adventure" game on Google Home. Since Google Home will be speaking to the player rather than the player reading the text, I'm hoping this will create an experience similar to the "Dungeons and Dragons" roleplaying game, with the computer working as the "Dungeon Master." With the natural language assistance offered by API.AI and Actions on Google, it seemed like a good fit, since the player can respond "naturally." Here's an example of an Amazon Alexa skill that does essentially what I'm going for.
However, every time I boot up the game, it's always a new game. I'd like to store a savegame with the user's previous state in a JSON file hosted on the user's Google Drive -- Since I'm just a student doing this for fun, I don't actually have an official website or anything beyond a free Heroku server I'm running the app from, making storing saves on my end pretty much out of the question.
I've walked through the Google Drive REST quickstart for Node.js, and I've gotten that working in the console just fine. The only problem is in that quickstart, the user has to click a link to authorize the application to read the stuff in their Google Drive account, and I'm not sure how I'd be able to "click a link" and give back an access token via voice on Google Home.
Is there a way to do this via Google Drive? Or is there a better way to provide persistent data between sessions? I don't normally work in web development, so any help would be appreciated.
The bad news is you won't be able to get away from the need for a user to use his web browser to authorise your app to access his Drive.
The good news is that you only need to do this once. When your app requests authoirsation, it should specify "offline", which will result in you being given a refresh token. You should save this somewhere in your database of users. Whenever you need to access the user's Drive, you can use the saved refresh token to request an access token and you're good to go.
You have a few problems that you need to solve here, and while they seem related, they're not as related as you might hope:
You need to get authorization to access a user's Drive space
You need to authenticate the user's Home (so you know this person has come back)
You have to connect the two relationships - so you know what Drive space to use for the Home device that is talking to you
You've found the answers to (1) already, and as noted, you'll need to use a browser for them to authorize you to access their Drive. You'll then store the refresh token and will be able to access it in the future.
But that is only part of the problem. Home does not provide you access to the user's Google account directly, so you'll have to manage your own account mechanism and tie it to Home. There are a few solutions here:
Home provides anonymous user identity in the JSON sent to your webhook. You can access this using getUser().user_id if you're using the Actions API library, or access this in the data.user.user_id field in the JSON. While this is similar to a browser cookie, it only stores the user ID and can't store additional data. There is also no concept of "local storage". On the plus side, this ID is consistent across devices.
You can request user information such as their name and address. But it doesn't have anything unique or account information, so this probably isn't useful to you.
You can implement an OAuth2 server and do account linking. Note that this is the other side from what you need to do with Google Drive - you'll be providing the access and refresh tokens to authenticate and authorize access to your account and the Google Home device will send these tokens back to you so you can determine who the user is. You don't actually need to store account information - you can provide token information using JSON Web Tokens (JWT) or other methods and have them store account information in a secure way. Users will use the Google Home app to actually sign-in to your service as a one-time event.
In order to handle (3), you may be thinking that (1) lets you get tokens and the OAuth solution for (2) requires you to hand out tokens. Can the two be combined? Well... probably, but it isn't as straightforward. You can't just give the Google OAuth2 endpoints to Home - they explicitly block that and you need to control your OAuth2 endpoints. You may, however, be able to build proxy endpoints - but I haven't explored the security implications of doing so.
I think you're on the right track - using Drive is a good place to store users' information. Using Home's account linking gives you a place where they have to come to your web site to authenticate and authorize their Home, and you can use this to do the same for their Drive.

sharing a users folder as admin

Trying to figure out if I can do the following via the box-api.
authenticate as an enterprise admin
lookup a user (in our case a special box user named "group_xxx" where this account will serve as a non-person shared group like "group_math_dept", "group_engineering_dept", etc...).
query for the root folder info for a given user-id (perhaps "GET /users//folders/0"
(tried that it doesn't work).
View the list of enterprise users with whom the given folder has been shared.
Modify the list of enterprise users with whom the given folder has been shared.
What I'd like to do is develop an app to delegate admin of these special group accounts to an appropriate individual in the given group. We can maintain who admins what locally. I can authenticate as one of our Box Admins (i.e. I have working code for steps 1 and 2). However, I don't see support in the API v2.0 doc for steps 3, 4, and 5.
Am I missing anything?
Unfortunately my understanding is the same as what you've found; that account and meta operations like steps 3 through 5 are not currently supported through the API.
UPDATE:
Looking at Box's developers blog it looks like functionality for steps 4 and 5 were actually just added, but are not yet in the documentation.
http://developers.blog.box.com/2012/09/10/v2-api-updates-keep-rolling/
Box actually has some more enterprise/admin API methods in private beta. Those are made accessible to early testers for a controlled environment, and include methods to perform operations on behalf of other users with administrative privileges.
If you're interested, feel free to email api [at] box [dot] com to discuss the testing of beta methods.