How to refresh the Outlook compose window after uploading an attachment through the rest API? - outlook-addin

I have an Outlook web addin which can be used in the compose window. What the addin does is, send a request to our server with the ID of the selected file to attach (Our server is a file storage system. The user will be able to select a file and attach it to the new email). The server will prepare the file and use the Outlook Rest API to attach the file to the email: https://learn.microsoft.com/en-us/previous-versions/office/office-365-api/api/version-2.0/complex-types-for-mail-contacts-calendar#referenceattachment
Sample request body:
{
"#odata.type": "#Microsoft.OutlookServices.ReferenceAttachment",
"Name": "Iglue picture",
"SourceUrl": "https://i.imgur.com/rNIYuhi.jpg",
"ProviderType": "Other",
"Permission": "Edit",
"IsFolder": "False"
}
Now the file gets attached successfully. But the problem is, the user have to reload Outlook to see the attached file. So my question is how to attach the file and trigger a refresh just like the Office JS API's Office.context.mailbox.item.addFileAttachmentAsync method?

In OfficeJS, currently there is no way to refresh Outlook UI form with the latest data from exchange server.
We track Outlook add-in feature requests on our user-voice page. Please add your request there. Feature requests on user-voice are considered, when we go through our planning process.

Related

How to use REST to download Outlook attachments from a node server?

Right now I use the ewsURL to fetch the attachments through a SOAP request. My Outlook Addin gets the ewsURL with a token and send it to the server and the server uses that to get the attachments. The problem is, this does not work for the mobile app. In mobile, I can't get the ewsURL. According to the docs, I have to use the REST API but it's not clear how to use it on the server side. Any help?
On the add-in side, there are a couple of differences when using Outlook REST APIs from an Outlook add-in:
Modify the getCallbackTokenAsync API call to include the isRest parameter.
Use the convertToRestId API on the itemId before sending it to the back-end.
On the server-side, here are some steps on getting started with Outlook REST APIs. The code you use to call the API will be different depending on the server-side language, and there are language-specific steps under the getting started section.
The main difference will be instead of registering the application and implementing OAuth2, you will be able to skip to the step where you use the Mail API (Node.js) and use the REST access token returned by the add-in API.
For calling the attachment API, see the docs for listing attachments on an item and getting attachments.
To test the token returned by the getCallbackTokenAsync API, try making a request like this one:
GET https://outlook.office365.com/api/v2.0/me/messages/<item id>
Authorization: Bearer <REST token>

Differentiating Application Upload and FTP Client uploads

Assume we have an web application where user will be provided an option to upload folder/file
Assume we have created an IAM and configured FTP to access S3 via FTP.
Now the user can upload a folder/file via FTP or web application.
We need to create a event notification or call a rest api whenever a new folder or file has been uploaded.
How to register an event register and call the rest API whenever a new folder or file has been uploaded?
How to differentiate whether the upload or file has been done from web application or FTP server from S3 ?
We need to call a different api when the folder has been created via web application and we need to call a different api when the folder has been created via FTP server
Thanks.
1) You can register to an object created event using lambda function via the properties of the bucket(ObjectCreated(All) event), and then execute a call to your API.
2) You can add a metadata to you file while uploading it saving the source of the upload. For example in your http request add the following header x-amz-meta-filesource. Every header starting with x-amz-meta- will be saved as the file metadata.

MS Graph API: OneDrive resource not found

I'm building a Windows service that connects to OneDrive for Business via the Graph API using this method:
https://graph.microsoft.io/en-us/docs/authorization/app_only
I've successfully authenticated my application and have a token for making calls to Graph API. I have given my Azure AD application permissions to both Windows Azure Active Directory and Microsoft Graph (all application and delegated permissions have been selected for both).
My goal is to get the contents of a folder that resides in a specific user's OneDrive. I need to make the following Graph API call:
//graph.microsoft.com/v1.0/users('user-guid')/drive/items/long-item-id-here/children
I can execute this request successfully using Microsoft Graph Explorer (logged in with my Office 365 credentials). When I try to make the same call as an application (using the auth token received above), I get an "itemNotFound" code with the message "The resource could not be found." (request-id:
5e814dce-c4c2-4615-90e6-ea8ab90cbc49). However, I am able to query the root and the "folder.childCount" property shows the correct number of children in the root:
//graph.microsoft.com/v1.0/users('user-guid')/drive/root
I've set the folder's sharing to "All Authenticated Users" and I still receive "The resource could not be found" from the API call.
Any ideas on what I'm missing here?
The marked answer is no longer the case. You can now access OneDrive and SharePoint resources using a Client Credentials grant (aka "App Only").
The applicable scopes are Files.Read.All, Files.ReadWrite.All, Sites.Read.All, Sites.ReadWrite.All
The application is using App-only authorization which is currently not supported for accessing OneDrive for Business through Microsoft Graph API. Please use delegated flow, which is used by Graph Explorer.

InfoPath "The SOAP message cannot be parsed"

I work on a simple list on a simple site/site collection/web app on a SharePoint 2010 test server which does not use SSL.
I then make a site collection backup and restord it onto our Production environment which have the same setup as the test server. The only difference is that it is set up to use SSL encryption and in particular for this web app.
When I want to customize the forms of the list using InfoPath I get a weird error message : "The SOAP message cannot be parsed".
This is when I click on the "Customize form" button in the ribbon which has the InfoPath icon:
Does anybody have already encountered such problem?
I have seen many posts about this error but this is because of athe time out issue when the list contains a lot of items. In my case, it is empty.
Thanks,
Sébastien
Actually, the problem was coming from the fact that InfoPath initially tried to connect using http to the SharePoint site. When the settings were changed to https, the IE cache still kept this setting and I had to remove it using the "Reset..." button located on the Advanced tab of the Internet options so that IE now opens up InfoPath using the right URL with https.
I was getting the error "The SOAP message cannot be parsed." while publishing a very complicated (list-based) InfoPath form in SharePoint Enterprise 2010. The issue only seemed to be effecting this form and not any others but would fail with either my personal account or the farm account.
After some experimenting with timing values within the InfoPath Service(s) we expanded the ExecutionTimeout in the Web.Config file within I.I.S. and that worked.

Forms Based Authentication SharePoint 2010 using SSRS HTML viewer

I'm running SSRS in integrated mode (Trusted) and have an issue with trying to use the HTML viewer on a Forms Based Authentication site in Sharepoint 2010. I have found several articles on using the report viewer in FBA; however, to the best of my knowledge, I need to use the HTML viewer as the ultimate goal is to seamlessly produce a PDF file for the end user. The error I'm getting is "401 UNAUTHORIZED An unknown error occurred with the Reporting Services endpoint on this SharePoint site." The Url format I'm submitting is as follows:
http:///_vti_bin/ReportServer?//.rdl&rs:Command=Render&rs:Format=PDF. Some additional information, the request works if I use the default site name and not the forms based name.
So my question is twofold, should I be able to do this in FBA? and if not what is the best route to produce a PDF of the report for the client?
Thanks
First of all, running SSRS with SharePoint is tricky. For SSRS to be able to receive the user credential, it has to be running in kerberos mode. Otherwise, the request to SSRS is made as ANONYMUS LOGON (that's why you are getting a 401).
Now, for the PDF, you have a few options :
Call the SSRS webservice directly and produce a PDF.
Setup a subscription and generate it as PDF, either to filesystem, email, etc.
Do what you are doing now, but with kerberos enabled.