Is it possible to download a mail(.eml) from outlook 365 using exchange service and store in database using c#

Hi All,
I have a outlook mail account ex:- my mail account id is
[email protected] , using c# code and Microsoft.Exchange.WebServices ,
 I want to download entair email and want to save this email in database , is it possible suggest me how can I go forward on this, if not possible please suggest some alternative ways to find the solution.
the reason want to store this entair mail is  on click on some button I want to open this mail from database in .eml format with attachments if any are there.
Thank in Advance
Ravi

Hello Ravi,
Try this:
http://msdn.microsoft.com/en-us/library/office/dn672317(v=exchg.150).aspx#sectionSection2
With regards,
Michael | Microsoft Exchange Developer Content
The
Exchange Development Forum Guide has useful information for using the Exchange Development Forum.
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

Similar Messages

  • Transfer mail accounts from Outlook 2003 to Outlook 2013

    Hello friends! 
    We changing computers in the office
    and I would appreciate some help.
    We are moving from Windows XP and
    Outlook 2003 to
    Windows 8.1 and
    Outlook 2013.
    That we can transfer mails with
    pst-files I know,
    but does anyone have a solution how to transfer
    our e-mail accounts.
    Each computer has 7 accounts linked
    to it and I'd rather not do it manually.
    Is there any solution?
    Many thanks for your help!
    Kind regards:
    Johannes, Sweden

    Hello friend, please read this thread:
    http://answers.microsoft.com/en-us/office/forum/office_2013_release-outlook/migrating-e-mail-account-from-outlook-2003-to-2013/e98d7a3b-2b1a-43b1-b2aa-3aeff173292d?msgId=272189da-d6a1-4062-bcb7-e1a321b402e9
    I would say it's not a stable way since the profile may easily get corrupted, so some people think it's not possible to complete the migration.
    Use Auto account setup and let Outlook 2013 set the accounts up for you.
    older versions:
    HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\
    Outlook 2013 profiles:
    HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Outlook\Profiles
    The steps at
    Moving outlook to a new computer apply to both Outlook 2010 and 2013.

  • I have a annual plan, it supposed must be used in two terminals, but i haven´t been able to install any app in a second computer, it always says that the app is only available as a trial download. What can I do to solve this issue, and be able to use my p

    I have a annual plan, it supposed must be used in two terminals, but i haven´t been able to install any app in a second computer, it always says that the app is only available as a trial download. What can I do to solve this issue, and be able to use my paid plan in two computers?

    Hi Susan,
    Please refer to the help document to fix this issue:
    Creative Cloud applications unexpectedly revert to trial mode | CS6, CCM
    You may also refer to the thread as below:
    creative cloud software says my free trial has expired, but I have a paid subscription
    Regards,
    Sheena

  • How to download a file version from office 365 using csom

    I need to download an older file version from office 365 and get the data into a byte array. I have no trouble downloading the latest version with File.OpenBinaryStream() and I have no trouble loading the previous file versions with File.Versions. But now
    I need to actually download an older version of the file and it seems the only way is to use File.OpenBinaryDirect. So I am creating a client context using my oAuth access token and providing the correct path, but I am getting a (401) Unauthorized
    error. Looking with Fiddler I can see that the call to OpenBinaryDirect is somehow trying to post to my file URL and the server is responding with 401.
    context = TokenHelper.GetClientContextWithAccessToken(SPHostUrl, AccessToken);
    FileInformation info = File.OpenBinaryDirect(context, "/" + _fileVersion.Url);  //throws 401
    //leading slash required otherwise ArgumentOutOfRangeException
    I have to be able to access the older file versions with my c# code -- I don't have a viable app without that ability -- any help urgently needed and greatly appreciated!

    Thank you SO much (Can't wait for the next release)!
    For anyone else who lands here, here's the code I ended up using:
    // VersionAccessUser and VersionAccessPassword are stored in web.config
    // web.Url is loaded via the clientContext
    // myVersion is the FileVersion I got from the file's Versions.GetById() method
    // probably a lot of ways to get hostUrl, it just needs to be https://yourdomain.sharepoint.com/
    // - I'm running my app from a subweb
    // I had trouble following the links to get the full MsOnlineClaimsHelper code
    // (the one on msdn.com was missing RequestBodyWriter, WSTrustFeb2005ContractClient,
    // and IWSTrustFeb2005Contract
    // so I've included the code I used here.
    string myVersionFullUrl = string.Format("{0}/{1}", web.Url, myVersion.Url);
    string userName = WebConfigurationManager.AppSettings.Get("VersionAccessUser");
    string strPassword = WebConfigurationManager.AppSettings.Get("VersionAccessPassword");
    string hostUrl = Regex.Replace(web.Url, "([^/]+//[^/]+/).*", "$1");
    MsOnlineClaimsHelper claimsHelper = new MsOnlineClaimsHelper(hostUrl, userName, strPassword);
    var client = new WebClient();
    client.Headers["Accept"] = "/";
    client.Headers.Add(HttpRequestHeader.UserAgent, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
    client.Headers.Add(HttpRequestHeader.Cookie, claimsHelper.CookieContainer.GetCookieHeader(new Uri(hostUrl)));
    var document = client.DownloadString(myVersionFullUrl);
    // These classes are needed to download old versions of files (see: http://social.msdn.microsoft.com/Forums/en-US/7746d857-d351-49cc-b2f0-496663239e02/how-to-download-a-file-version-from-office-365-using-csom?forum=sharepointdevelopment)
    // I cobbled this file from http://social.technet.microsoft.com/Forums/msonline/en-US/4e304493-7ddd-4721-8f46-cb7875078f8b/problem-logging-in-to-office-365-sharepoint-online-from-webole-hosted-in-the-cloud?forum=onlineservicessharepoint
    // and http://fredericloud.com/2011/01/11/connecting-to-sharepoint-with-claims-authentication/
    using Microsoft.IdentityModel.Protocols.WSTrust;
    using Microsoft.SharePoint.Client;
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Net;
    using System.Net.Security;
    using System.ServiceModel;
    using System.ServiceModel.Channels;
    using System.Text;
    using System.Web;
    using System.Xml;
    using System.Xml.Linq;
    namespace DPSiDoxAppWeb.Helpers
    /// <summary>
    /// Create a new contract to use for issue claims for the SharePoint requests
    /// </summary>
    [ServiceContract]
    public interface IWSTrustFeb2005Contract
    [OperationContract(ProtectionLevel = ProtectionLevel.EncryptAndSign,
    Action = "http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue",
    ReplyAction = "http://schemas.xmlsoap.org/ws/2005/02/trust/RSTR/Issue",
    AsyncPattern = true)]
    IAsyncResult BeginIssue(Message request, AsyncCallback callback, object state);
    Message EndIssue(IAsyncResult asyncResult);
    /// <summary>
    /// Implement the client contract for the new type
    /// </summary>
    public class WSTrustFeb2005ContractClient : ClientBase<IWSTrustFeb2005Contract>, IWSTrustFeb2005Contract
    public WSTrustFeb2005ContractClient(Binding binding, EndpointAddress remoteAddress)
    : base(binding, remoteAddress)
    public IAsyncResult BeginIssue(Message request, AsyncCallback callback, object state)
    return Channel.BeginIssue(request, callback, state);
    public Message EndIssue(IAsyncResult asyncResult)
    return Channel.EndIssue(asyncResult);
    /// <summary>
    /// Create a class that will serialize the token into the request
    /// </summary>
    class RequestBodyWriter : BodyWriter
    readonly WSTrustRequestSerializer _serializer;
    readonly RequestSecurityToken _rst;
    /// <summary>
    /// Constructs the Body Writer.
    /// </summary>
    /// <param name="serializer">Serializer to use for serializing the rst.</param>
    /// <param name="rst">The RequestSecurityToken object to be serialized to the outgoing Message.</param>
    public RequestBodyWriter(WSTrustRequestSerializer serializer, RequestSecurityToken rst)
    : base(false)
    if (serializer == null)
    throw new ArgumentNullException("serializer");
    _serializer = serializer;
    _rst = rst;
    /// <summary>
    /// Override of the base class method. Serializes the rst to the outgoing stream.
    /// </summary>
    /// <param name="writer">Writer to which the rst should be written.</param>
    protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
    _serializer.WriteXml(_rst, writer, new WSTrustSerializationContext());
    public class MsOnlineClaimsHelper
    #region Properties
    readonly string _username;
    readonly string _password;
    readonly bool _useRtfa;
    readonly Uri _host;
    CookieContainer _cachedCookieContainer = null;
    DateTime _expires = DateTime.MinValue;
    #endregion
    #region Constructors
    public MsOnlineClaimsHelper(string host, string username, string password)
    : this(new Uri(host), username, password)
    public MsOnlineClaimsHelper(Uri host, string username, string password)
    _host = host;
    _username = username;
    _password = password;
    _useRtfa = true;
    public MsOnlineClaimsHelper(Uri host, string username, string password, bool useRtfa)
    _host = host;
    _username = username;
    _password = password;
    _useRtfa = useRtfa;
    #endregion
    #region Constants
    public const string office365STS = "https://login.microsoftonline.com/extSTS.srf";
    public const string office365Login = "https://login.microsoftonline.com/login.srf";
    public const string office365Metadata = "https://nexus.microsoftonline-p.com/federationmetadata/2007-06/federationmetadata.xml";
    public const string wsse = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
    public const string wsu = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
    private const string userAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)";
    #endregion
    class MsoCookies
    public string FedAuth { get; set; }
    public string rtFa { get; set; }
    public DateTime Expires { get; set; }
    public Uri Host { get; set; }
    // Method used to add cookies to CSOM
    public void clientContext_ExecutingWebRequest(object sender, WebRequestEventArgs e)
    e.WebRequestExecutor.WebRequest.CookieContainer = getCookieContainer();
    //e.WebRequestExecutor.WebRequest.UserAgent = userAgent;
    // Creates or loads cached cookie container
    CookieContainer getCookieContainer()
    if (_cachedCookieContainer == null || DateTime.Now > _expires)
    // Get the SAML tokens from SPO STS (via MSO STS) using fed auth passive approach
    MsoCookies cookies = getSamlToken();
    if (cookies != null && !string.IsNullOrEmpty(cookies.FedAuth))
    // Create cookie collection with the SAML token
    _expires = cookies.Expires;
    CookieContainer cc = new CookieContainer();
    // Set the FedAuth cookie
    Cookie samlAuth = new Cookie("FedAuth", cookies.FedAuth)
    Expires = cookies.Expires,
    Path = "/",
    Secure = cookies.Host.Scheme == "https",
    HttpOnly = true,
    Domain = cookies.Host.Host
    cc.Add(samlAuth);
    if (_useRtfa)
    // Set the rtFA (sign-out) cookie, added march 2011
    Cookie rtFa = new Cookie("rtFA", cookies.rtFa)
    Expires = cookies.Expires,
    Path = "/",
    Secure = cookies.Host.Scheme == "https",
    HttpOnly = true,
    Domain = cookies.Host.Host
    cc.Add(rtFa);
    _cachedCookieContainer = cc;
    return cc;
    return null;
    return _cachedCookieContainer;
    public CookieContainer CookieContainer
    get
    if (_cachedCookieContainer == null || DateTime.Now > _expires)
    return getCookieContainer();
    return _cachedCookieContainer;
    private MsoCookies getSamlToken()
    MsoCookies ret = new MsoCookies();
    try
    var sharepointSite = new
    Wctx = office365Login,
    Wreply = _host.GetLeftPart(UriPartial.Authority) + "/_forms/default.aspx?wa=wsignin1.0"
    //get token from STS
    string stsResponse = getResponse(office365STS, sharepointSite.Wreply);
    // parse the token response
    XDocument doc = XDocument.Parse(stsResponse);
    // get the security token
    var crypt = from result in doc.Descendants()
    where result.Name == XName.Get("BinarySecurityToken", wsse)
    select result;
    // get the token expiration
    var expires = from result in doc.Descendants()
    where result.Name == XName.Get("Expires", wsu)
    select result;
    ret.Expires = Convert.ToDateTime(expires.First().Value);
    HttpWebRequest request = createRequest(sharepointSite.Wreply);
    byte[] data = Encoding.UTF8.GetBytes(crypt.FirstOrDefault().Value);
    using (Stream stream = request.GetRequestStream())
    stream.Write(data, 0, data.Length);
    stream.Close();
    using (HttpWebResponse webResponse = request.GetResponse() as HttpWebResponse)
    // Handle redirect, added may 2011 for P-subscriptions
    if (webResponse.StatusCode == HttpStatusCode.MovedPermanently)
    HttpWebRequest request2 = createRequest(webResponse.Headers["Location"]);
    using (Stream stream2 = request2.GetRequestStream())
    stream2.Write(data, 0, data.Length);
    stream2.Close();
    using (HttpWebResponse webResponse2 = request2.GetResponse() as HttpWebResponse)
    ret.FedAuth = webResponse2.Cookies["FedAuth"].Value;
    ret.rtFa = webResponse2.Cookies["rtFa"].Value;
    ret.Host = request2.RequestUri;
    else
    ret.FedAuth = webResponse.Cookies["FedAuth"].Value;
    ret.rtFa = webResponse.Cookies["rtFa"].Value;
    ret.Host = request.RequestUri;
    catch (Exception ex)
    return null;
    return ret;
    static HttpWebRequest createRequest(string url)
    HttpWebRequest request = HttpWebRequest.Create(url) as HttpWebRequest;
    request.Method = "POST";
    request.ContentType = "application/x-www-form-urlencoded";
    request.CookieContainer = new CookieContainer();
    request.AllowAutoRedirect = false; // Do NOT automatically redirect
    request.UserAgent = userAgent;
    return request;
    private string getResponse(string stsUrl, string realm)
    RequestSecurityToken rst = new RequestSecurityToken
    RequestType = WSTrustFeb2005Constants.RequestTypes.Issue,
    AppliesTo = new EndpointAddress(realm),
    KeyType = WSTrustFeb2005Constants.KeyTypes.Bearer,
    TokenType = Microsoft.IdentityModel.Tokens.SecurityTokenTypes.Saml11TokenProfile11
    WSTrustFeb2005RequestSerializer trustSerializer = new WSTrustFeb2005RequestSerializer();
    WSHttpBinding binding = new WSHttpBinding();
    binding.Security.Mode = SecurityMode.TransportWithMessageCredential;
    binding.Security.Message.ClientCredentialType = MessageCredentialType.UserName;
    binding.Security.Message.EstablishSecurityContext = false;
    binding.Security.Message.NegotiateServiceCredential = false;
    binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
    EndpointAddress address = new EndpointAddress(stsUrl);
    using (WSTrustFeb2005ContractClient trustClient = new WSTrustFeb2005ContractClient(binding, address))
    trustClient.ClientCredentials.UserName.UserName = _username;
    trustClient.ClientCredentials.UserName.Password = _password;
    Message response = trustClient.EndIssue(
    trustClient.BeginIssue(
    Message.CreateMessage(
    MessageVersion.Default,
    WSTrustFeb2005Constants.Actions.Issue,
    new RequestBodyWriter(trustSerializer, rst)
    null,
    null));
    trustClient.Close();
    using (XmlDictionaryReader reader = response.GetReaderAtBodyContents())
    return reader.ReadOuterXml();

  • I downloaded the newest version of firefox today 8/16/11 and now I cannot use Evernote (nor does clipmarks work from before) this is unacceptable. How do I return to the earlier version of firefox? Thank You, Carol Roberts

    I downloaded the newest version of firefox today 8/16/11 and now I cannot use Evernote (nor does clipmarks work from before) this is unacceptable. How do I return to the earlier version of firefox? If there is no way to do this, then I will have to use internet explorer so I hope you can help me with this. Thank You, Carol Roberts

    Until Evernote updates their add-on to mark it compatible with Firefox 6, you can use the [https://addons.mozilla.org/en-US/firefox/addon/add-on-compatibility-reporter/ Add-on Compatibility Reporter] to try re-enabling it yourself.
    You can also downgrade to a previous version of Firefox from [https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/ this archive], but please be warned that some old versions of Firefox have known security bugs that are fixed in later versions. See also: [[Installing a previous version of Firefox]]

  • Is it possible to take the CDR data from a v4.2 Call Manager and copy it to a separate server where it would be made available for reporting?

    Is it possible to take the CDR data from a v4.2 Call Manager and copy it to a separate server where it would be made available for reporting? We are not interested in migrating the CDR data to v6 because of the concerns it introduces to the upgrade process. Is it possible to get the raw data and somehow serve it from a different machine? (knowing it would be 'old' data that stops as of a certain date). If so, what would be the complexity involved in doing so?
    It seems like the CDR data lives within MSSQL and the reporting interface is within the web server portion of the Call Manager... that's as far as we've dug so far.

    Hi
    It is absolutely possible to get the data - anyone you have in your org with basic SQL skills can move the data off to a standalone SQL server. This could be done most simply by backing up and restoring the DB using SQL Enterprise Manager.
    Moving the CAR/ART reporting tool would be more difficult... if you do actually use that for reporting (most people find it doesn't do what they need and don't use it for anything but basic troubleshooting, and get a third party package) then the best option may be to keep your publisher (possibly assigning it a new IP) and leave it running for as long as you need reporting.
    You would then need a new server to run your upgraded V6 CCM; you may find you need this anyway.
    Regards
    Aaron
    Please rate helpful posts...

  • How do I migrate mail folders from outlook on windows

    How can I migrate mail folders from outlook on windows

    Your best bet is to use Migration Assisant. Pondini has written an excellent guide located at:http://www.pondini.org/OSX/Setup.html and Apple discusses what will be imported in this advice letter http://support.apple.com/kb/HT4796

  • HT4623 I am using iphone GS3 and jailbreak the iOS using 5.0.1 can I download and install iOS5.1.1

    I am using iphone GS3 and jailbreak the iOS using 5.0.1 can I download and install iOS5.1.1

    Per Terms of Use to which you agreed when you joined this
    forum, discussion of jailbroken iPhones is prohibited. You will
    get no help here.
    Be advised the jailbreak made unknown alterations to the iPhone
    which will prevent future upgrades, open up the OS to malware,
    and may result in it becoming useless - a brick, if you will.

  • Not receiving mail sent to and from my own accounts! using latest OS8 and X10.9.5.Using Apple Mail account. Used to be able to do this!

    Not receiving mail sent to and from my own accounts! using latest OS8 and X10.9.5.Using Apple Mail account. Used to be able to do this!

    My system is OS8 and X10.9.5

  • I have Lion, and I can't see my unread messages count in the dock, even after the preferences set up. I find the Lion Mail too complicated. Leopard was much easier and more simple to use. I only have one account& don't need all the rest. any suggestions

    I have Lion, and I can't see my unread messages count in the dock, even after the preferences set up.
    I find the Lion Mail too complicated. Leopard was much easier and more simple to use. I only have one account& don't need all the rest.
    any suggestions?

    weird.
    It's so frustrating, I got my Mac Book 5 days ago and I'm already having a discussion in the forum.
    Thank you so much for your prompt replies.
    It's past midnight here so I'd better get some rest...
    Good night captfred!

  • HT1386 having trouble syncing/downloading contacts & calendar & tasks from outlook 2010 to iphone4s help please.

    having trouble syncing/downloading contacts & calendar & tasks from outlook 2010 to iphone4s help please.

    I had the identical problem.  I still don't know how to sync the tasks, but here's how I did the contacts and calendar:
    1.  Connect the 4s to the computer.
    2.  Open iTunes.
    3.  Click the iPhone box in the upper right corner.
    4.  Click on the info tab.
    5.  Hit the checkbox Sync Contacts with... and choose Outlook from the dropdown box.
    6.  Ditto for Calendars.
    7.  Hit Apply.
    My problem was that originally, I wasn't getting the checkboxes.  I turned off the iCloud settings on the 4s.  That did the trick.

  • Downloaded iOS 8.0.2 now I have no service and Touch ID doesn't work. Anybody else have this problem? I have tried rebooting and also took out SIM card and nothing has worked

    rreally need some help with this For the iPhone 6. Downloaded iOS 8.0.2 now I have no service and Touch ID doesn't work. Anybody else have this problem? I have tried rebooting and also took out SIM card and nothing has worked

    No. I have no problems what so ever since my update to iOS 8.0.2.
    Have you tried to do a restore ?

  • I bought a MacBook Pro in USA and I live in Brazil. Is it possible to download a Mail software in Brazilian Portuguese

    I bought a MacBook Pro in USA but I live in Brazil and I would like to use the Mail software in Brazilian Portuguese. Is it possible to download a version in Portuguese?

    You don't need to download any additional software. Just change the language of your system to Portuguese.
    http://docs.info.apple.com/article.html?path=Mac/10.6/en/26684.html
    Regards.

  • IS IT POSSIBLE TO DOWNLOAD RINGTONES TO MBP FROM RAZR CELL PHONE???

    Does anyone know if it is possible to download ringtones from my RAZR cell phone to my MBP? If it is possible, how do I do it. Thanks.

    I have a moto slvr L7c from verizon which I can browse via bluetooth. I was surprised I was able to since it is well noted that VZ locks their phones so you have to use VCast. I have had no luck with ringtones however...I get the transfer error Faulty was speaking of when trying to drag to the ringtone folder. The phones ringtones are not in the folder so they must be in some part of the memory I cannot access. I have been able to transfer pictures (jpegs)..video (in 3gpp2 and mpeg4 formats) to the phone via bluetooth from my MBP. Music you can only do under windows (in my case XP) via usb cable and Win Media Player 10.....wav files only I guess.
    Sorry that doesn't help your ringtone question.
    MacBook Pro core duo 2.16 rev 1,1   Mac OS X (10.4.8)  

  • Where can i download a mail server from

    Hi
    I'm trying to create a mail tool. my workplace uses lotus notes so i'm presuming thats why it doesn't work at the moment - i need a SMTP server. i get error messages of ..
    "MessagingException: Could not connect to SMTP host: xxxxx"
    "ConnectException: Connection refused: connect"
    Am i correct in thinking this is the reason?
    So, can anyone recommend where i can download an SMTP server from ?
    Thanks
    joj

    Before you rush off to install an SMTP server, I would suggest you talk to the people who support Notes at your place. It may already have an SMTP server but you don't know where it is. They may also frown upon you installing a rogue server on their network -- although you may not do much harm unless you actually manage to get its address registered in your corporate DNS so it's visible from the Internet.

Maybe you are looking for

  • Question regarding use of Log and LogFactory in Servlets

    Hi, I saw the following code in an application and I would like to know where the log information would be stored. It appears that the log information is not displayed on the screen and was not able to find out where the log files are. The applicatio

  • JRadioButton Selection color

    I have a ButtonGroup and I want to change the color that the system uses to indicated the currently selected button. Anyone have the simple answer?

  • BW statistics for Process chains

    Hi All. We want to do some analysis on our process chains... like which process chains takes the longest to run, which InfoPackages (or other steps) in a process chain takes up most of the time etc... The BW statistics cubes like 0BWTC_C05 keeps nice

  • Can I get flash player 8 on iPad for games?

    I tried to run a game on safari and I was told I need flash player 8.  How do I get this for my iPad 3.

  • Internet Explorer 10 install by WSUS

    Hey guys, hit a bit of a snag with IE 10. I'm trying to push out IE10 through WSUS on some test PCs. I've imported the package and go to push out update. 32 and 64 bit are in the package, 32 bit is successful. Then it fails on 64. Any and all help wo