Outlook Add-in file reading from mail - outlook

I am working on a Outlook add-in. I am not able to use the method item.getAttachmentsAsync in my plugin code to load and read the content of files.
I am getting ERROR TypeError: item.getAttachmentsAsync is not a function in run time.
var item = Office.context.mailbox.item;
var options = {asyncContext: {currentItem: item}};
item.getAttachmentsAsync(options, this.callback);
My requirement is explained below,
In the plugin we have a form and few fields are populated from mail body.
And I need mail attachments to auto upload to Form.
Please suggest a better way to do that.

using getAttachmentContentAsync I am able to get the file as a blob. but the problem is we need to call this method as soon after the mail opening. otherwise getting cors error

Related

How to call an external API in truclient protocol of loadrunner

I am recording a script using truclient protocol.In my script ,i need to externally call an API which generates the Password. The password is fetched using the co-relation,which is used as an input for Login.
I am however unable to call the external API using the true client protocol.
Could anybody please suggest how to call an external API in true client protocol.
Have you tried the evaluate JavaScript step? You can post the message to the server and get the generated password during the runtime. XHR and fetch API should be supported in Chrome and Firefox, TCIE should support XHR.
Sure. Please check the detail steps:
Drag and drop an evaluate JS step from TruClient
Open the script editor
Add these code, make sure use the sync XHR to ensure the password is returned before the end step started:
var xhr = new XMLHttpRequest();
xhr.open("POST", '/server', false);
//Send the proper header information along with the request
xhr.setRequestHeader("xxx", "value");
xhr.send();
if (this.status === 200) {
// Request finished. Do processing here.
}
var password = xhr.response;
Change the login password step from plain text to JS and use
ArgsContext.password
to reference the previous received password.
If you have another questions please let me know. How to use the argument context you could reference this link.
BTW. the window and document object of the page can be referenced with AUT.window, AUT.document in TruClient.
Please check the help document from here.

Outlook 365 get Mail Item

I have following problem:
We have an Outlook Addin (VSTO), with which we archive emails (orders) in SAP.
Now the plugin should be implemented for Outlook 365. I already looked at the new api and i get die subject or maitext but there seems no way to get to the raw .msg file.
So my question now is, is there a way to get an mailitem as an .msg file (or any other format)?
There are two ways may be you can try
Use the process to run the .msg
string file= #"C:\PWS\myMail.msg";
Process.Run(file);
Use OpenSharedItem to open it:
var app = new Outlook.Application();
var item = app.Session.OpenSharedItem(msgfile) as Outlook.MailItem;
//Do stuff with the mail.
item.Close(OlInspectorClose.olDiscard);
app.Quit();
Marshal.ReleaseComObject(item);

How to send an email with multiple attachments from Gmail using API client library for .NET

My app uses Google API client library for .NET to send emails with attachments.
When using Send(), I'm facing some limitations when it comes to file size of the attachments. So, I guess switching to Resumable upload as upload method may help. But it's pretty much undocumented.
Looking into source code, I guess using different Send() overload may be the way forward, but I can't figure out how to use it properly.
So, instead of attaching the files into message and calling it like this:
var gmailResult = gmail.Users.Messages.Send(new Message
{
Raw = base64UrlEncodedMessage
}, "me").Execute();
I should not attach the files to message and do something like following?
var gmailResult = gmail.Users.Messages.Send(new Message
{
Raw = base64UrlEncodedMessage
}, "me", fileStream, contentType).Upload();
The second version does not return any API error, but does nothing. I'm obviously missing something here.
How do I attach more than one attachment?
This is kind of an old question, but putting an answer here just in case anyone else needs it:
I was able to achieve this by converting my mime message into a stream (attachment(s) included), and then calling this overload on Send:
UsersResource.MessagesResource.SendMediaUpload googleSendRequest = service.Users.Messages.Send(null, "youremail#gmail.com", mimeMessageStream, "message/rfc822");
IUploadProgress created = googleSendRequest.Upload();
This will upload all of the attachments with the email message content and then send it off. I was able to send two 5 megabyte attachments in an email. Previously I was not able to send even one of those via the other Send method that takes in a base64 encoded mime message.

VSTO (Outlook) is forcing MSG attachments to be of olEmbeddeditem type, but olByValue needed

I need to send email with .msg file attached to Lotus Notes (Domino) by using VSTO (from Outlook Add-In). When this file is received in Lotus Notes, the email body from msg file is appended to the end of the main mail.
From this problem I am assuming that the issue is in attachment type.
I am trying to set the attachment type to by olByValue by adding attachment :
mail.Attachments.Add(msgFilePath, OlAttachmentType.olByValue, 0, displayName);
but whatever type I specify, it is still set to olEmbeddeditem.
Is there any way, how to force msg attachment to be olByValue?
Thank you for any suggestion or advise.
Have a nice day.
Note: For reference I have created email in Lotus-Notes too with msg attached, sent to Outlook and than forwarded back to Lotus-Notes and msg is attached not appended to the end.
There is not much you can do in the Outlook Object Model - it always tries to be "helpful" and converts MSG files to embedded message attachments. If using Redemption is an option (I am its author), it will not change the type:
SafeMailItem sItem = new SafeMailItem();
sItem.Item = mail;
sItem.Attachments.Add(msgFilePath);

Is there any way to manually initiate an AJAX upload with the Kendo Upload control

I am doing an upload via CORS to Amazon S3 with the Kendo Upload control. I'm having an issue with the fact that I need to grab a signature from my server, then add it to the 'data' for the event object of 'upload' handler I created. The problem is, of course, that in the handler I fire off an async request to get the signature, and the upload handler continues on it's merry way without the signature data i need. The published API has no 'upload()' or something command that I could call when my async request returns.
I saw an ASP-Kendo-S3 example somewhere, but it's not exactly clear from that code, how that signature is being obtained, and of course, I'm not using ASP.
Kendo Upload has an onUpload event. In Kendo's asp.net example there really isn't anything specific to that framework that wouldn't port to anything else.
They populate the page initially with the profile (base64 encoded JSON).
To get a signature for that base64 encoded json profile they use this method (C#):
private static string Sign(string text, string key)
{
var signer = new HMACSHA1(Encoding.UTF8.GetBytes(key));
return Convert.ToBase64String(signer.ComputeHash(Encoding.UTF8.GetBytes(text)));
}
It looks pretty self explanatory to the point where you could port it to another language.

Resources