Quantcast
Channel: Exchange Server Development forum
Viewing all 7132 articles
Browse latest View live

How to read an email from an exchange mailbox and save to disk

$
0
0

I have this code but it dont work 

I dont know how to put the "emails" in the "message". Do you have an idea ? Or another code ? 

                       

  int offset = 0;
            int pageSize = 50;
            bool more = true;
            ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013);

            service.Credentials = new NetworkCredential("XXX", "XXX", "XXX");
            service.UseDefaultCredentials = false;
            service.AutodiscoverUrl("XXX", RedirectUrlValidationCallback);
            ItemView view = new ItemView(pageSize, offset, OffsetBasePoint.Beginning);

            view.PropertySet = PropertySet.IdOnly;
            FindItemsResults<Item> findResults;
            MailMessage message;
            List<EmailMessage> emails = new List<EmailMessage>();

            while (more)
            {
                findResults = service.FindItems(WellKnownFolderName.Inbox, view);
                foreach (var item in findResults.Items)
                {
                    emails.Add((EmailMessage)item);

                   message.  ???????

                    SmtpClient client = new SmtpClient("XXX");
                    client.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
                    client.PickupDirectoryLocation = @"C:\";
                    client.Send(message);
                }
           }


will it lost email when Exchange Transport Agent(Route Agent) crash(cause MSExchangeTransport service crash) ?

$
0
0

I write an Exchange Transport Route Agent, and it will call an interface in C++ COM Component. previously, the component crash, leads MSExchangeTransport service restart. and the original email didn't lost, it will be passed to my Agent again.

it seems that Exchange Transport Route agent Crash can't cause the lost of email. is it right?

How to pull all meetings from Exchange calendar for multiple people ?

$
0
0

We are trying to pull all the meetings of team members and put them as a central calendar, possibly on a ASP.NET page. This pull can happen once in a day. Is there any web service or other end point from Exchange server which can be used for this requirement ?

Thanks

Aravind


Aravind aravindl.blogspot.com

Replying to Postitem created through EWS doesn't chain the conversation

$
0
0

If I create a PostItem using Exchange WebServices and then in Outlook calls Reply() on that PostItem then the Reply MailItem isn't chained off the PostItem. If I create the PostItem in Outlook then calls Reply() everything works correctly.

I discovered that the PostItem created using EWS had OutlookInternalVersion = 0. When PostItem is created using Outlook then OutlookInternalVersion has been filled with 154615.

Is this a bug in EWS?

Best regards Esben Rud Nielsen, Bankdata, DK

Unable to read attachments from Exchange Server 2010 using EWS Managed API.

$
0
0

Hi,

I am getting following error while trying to read attachments from Exchange Server 2010 using EWS Managed API. 

The request failed. Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.

Please find my code below. Getting error at fileAttachment.Load

    ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);

            try
            {
                service.Url = new Uri(ConfigurationManager.AppSettings["EWS"]);

                service.Credentials = new NetworkCredential("XXXX","XXX", "XXX");

                FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox, new ItemView(100));

                EmailMessage message;

                foreach (Item item in findResults.Items)
                {
                    message = EmailMessage.Bind(service, item.Id, new PropertySet(BasePropertySet.IdOnly, ItemSchema.Attachments));

                    message.Load();

                    if (message.HasAttachments)
                    {
                        foreach (Attachment attachment in message.Attachments)
                        {
                            if (attachment is FileAttachment)
                            {
                                FileAttachment fileAttachment = attachment as FileAttachment;
                              
                                fileAttachment.Load(@"C:\Mohan\Mail\"+ fileAttachment.Name);
                            }
                        }
                    }
                }           
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }



Mohan Raju

Linking Exchange to Google App

$
0
0

This is the setup:

I have registered a domain (XXX.COM) on Google App, through enom, where by browsing to gmail, users can easily access their mail.

I would like to bring an Organisational Exchange Server to the party!

I have gone for the whole-brain approach, and internally registered a domain (XXX.DOM).

The Exchange server is behind a router, therefore registered with a private ip (192.168.X.X). It however, can still access the internet via NAT configuration on the router.

Internal mails, where users are registered as user@XXX.DOM work fine.

So this is my dilemma:

1. Is there a way for new users being created to AUTOMATICALLY have their email addresses registered as user@XXX.COM

2. (the tricky part) Link Exchange to Google.

NB: I have obtained the MX records from Google and added them to my DNS server.

(I KNOW ITS QUITE A BIT BUT EVEN A TUTORIAL LINK WOULD SUFFICE)


Exchange Server

$
0
0

HI

I have exchange server 2010 and 2 internet service links, is there solution to let the server switch between links when the first link is down?

Note: I have TMG to control the network .

WSDL https://outlook.office365.com/EWS/services.wsdl contains no service definition.

$
0
0

I am trying to access EWS from an Office 365 Exchange environment using JAVA. When trying to create a Port with I am able to authenticate with my username and password, but get this exception when trying to instantiate the ExchangeWebService object:

javax.xml.ws.WebServiceException: WSDL outlook.office365.com/.../services.wsdl contains no service definition.


Why is there no service definition in the WSDL? Do I need to provide a different WSDL URL?


[E2010][EWSMA][C#] Odd caching behavior with deactivated mailboxes

$
0
0

I have a simple program that is retrieving older emails sent to me by a now-deactivated Exchange mailbox. Filtering by the sender's email address yields no results, but I found I was still able to retrieve specific emails using other filters (on subject, ID, etc.)

When I run this the first time and view the Sender property on the EmailMessage instance, I get a RoutingType of "EX" and instead of an email address, the long format Exchange name (not sure what these are called - looks similar to a Distinguished Name).

On subsequent calls however, the RoutingType becomes "SMTP" and I get the expected email address. The API will continue to return the SMTP address for some time but eventually (< 48 hours from what I've seen so far) it will start returning the EX addresses again.

My question is: what is going on under the hood here? It appears that the information is being cached after the first request, but is there a way to bypass this and resolve the EX address string into an SMTP address?

Resource not found for the segment 'ClientSoftwareBrowserDetail'

$
0
0

Hi all,

We have a customer who cannot access this REST API:  

reports.office365.com/ecp/reportingwebservice/reporting.svc/ClientSoftwareBrowserDetail

Do you know if this is expected or a bug?

Regards,

Kenny

import appointments to the outlook calendar from csv

$
0
0

hi,
We have an excel spreadsheet with the appointments.I have EWS installed on my Exchange Server 2010. Is there anyway to import the appointments to the Outlook non-default calendar using powershell.

I have followed this http://blogs.msdn.com/b/emeamsgdev/archive/2012/02/13/exchange-2007-2010-powershell-import-calendar-items-from-csv-file.aspx and I can successfully import it to the default calendar.

Any help would be much appreciated, thank you.

When service running with Group Managed Service Account, EWS will not work?

$
0
0

Hi

I'm using Group Management Service Account to run my service, and this service will call EWS api to get sub folders in user's mailbox.  And I've assigned the impersonate permission to this service account.

But when it runs, an exception has comes out,

Exception caught and ignored: The SMTP address has no mailbox associated with it., StackTrace:    at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ProcessWebException(WebException webException)
   at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.GetEwsHttpWebResponse(IEwsHttpWebRequest request)
   at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ValidateAndEmitRequest(IEwsHttpWebRequest& request)
   at Microsoft.Exchange.WebServices.Data.MultiResponseServiceRequest`1.Execute()
   at Microsoft.Exchange.WebServices.Data.ExchangeService.BindToFolder[TFolder](FolderId folderId, PropertySet propertySet)

And in the meantime, in the windows event log, there's an error come out,

(Process w3wp.exe, PID 9092) "RBAC authorization returns Access Denied for user SMEX12\SMEX12Test$ (SID=S-1-5-21-709115522-1612298502-133514736-1673). Reason: User was not found on Domain Controller ex2016ad.smex12.com."

and my group management service account is SMEX12\SMEX12Test$,  and here is the code which have this exceptions below,

rootFolder = Folder.Bind(service, WellKnownFolderName.MsgFolderRoot);

So could you help me? How could I fix this error?  Because I need to use group management service to run service.

Thanks.


Which permissions do I need to run these Exchange cmdlets?

$
0
0

Hi

Now, I'm using a domain account to run a process, this process will execute these Exchange cmdlets below.

Get-MailboxDatabase,

Get-PublicFolderDatabase,

Get-MailboxDatabaseCopyStatus,

Get-Mailbox,

Get-MailboxPermission,

Get-User

So I want to know which permission do I need to run these cmdlets.  From Microsoft's doc, https://technet.microsoft.com/en-us/library/dd638132(v=exchg.160).aspx, it tell me I can assign "Organization Management" to this user, but this permission contains so many roles inside it, its permission is too high.

After I tested, I found if I assign "Public Folder Management" permission to this user, it can work.  But I'm wondering why this public folder management can allow me to get mailbox like these cmdlets. Is it correct?

Thanks very much.


[E2010][EWSMA][C#]Null MailboxType property from all Appointment Attendees

$
0
0

When going over Appointment objects returned from the EWS API, I want to make a distinction between mailboxes  belonging to users and those belonging to distribution lists. This is not a problem with EmailMessage objects, as when I look at the Sender, ToRecipients, CcRecipients, and BccRecipients fields, I can reference the MailboxType property on the EmailAddress object to determine the type of account corresponding to the EmailAddress object.

With Appointments however, I only ever get null values for the MailboxType property on the Attendee objects from RequiredAttendees and OptionalAttendees (Sender, an EmailAddress property, is often non-null on the Appointment objects). Is there a way to have the API return non-null values for MailboxTypes when an Appointment Attendee is returned?

Change Calendar permission in Exchange 2007

$
0
0

 Hi,

  I have this script to change calendar on Exchange 2007. Well I have put the EWSUtil.dll in the c:\temp folder and

   and the script is running fine I guess, I have this. I have option to chose the Hub or the mailbox servers.

  I chose HUB do not know if that is correct. I do not know how this script works and i do not want to destroy  something by

   mistake. So what do I do next? This Exchange is in a hosting environment so I need to choose which calendar to change.

   Do I need to  use "EWS Impersionation" og do I use "special Credentials" ? to get list of users cal. do I use "Enum Perms"

   to get all cals  and from the list I choose items and  "New Permission Settings" my new permission  and then Apply to

    complete?

    Pls adv, 

    thanks.

  


Erro


Documentation for 2010 Exchange Server Web Service and for moving from 2007 Exchange Web Service to 2010 Exchange Web Service

$
0
0

Hi,

We have an application heavily using Exchange 2007 Exchange Web Service and want to move to 2010 version of Exchange Web Service.

I want to ask if there is any documentation regarding 2010 Exchange Web Service and any documentation into moving web services from 2007 to 2010 version of Exchange. If the documentation would have any examples in C# or Java language that would be very helpful.

Also I want to ask what support is available into doing this move.

Thank you,

Adrian


Exchange IMAP search on “From” field in INBOX folder

$
0
0
I'm trying to do an IMAP search on Exchange using Javamail. I'm trying to search the FROM field for a particular email address. But the response I'm getting looks like the search is being done on the From Label rather than the email address. For example, if my From Label is "Smith, Marjorie" and the corresponding email address is margie_smith@org.com, when the search term value = margie_smith@org.com, I don't get a response. If I look for emails containing "margie", I still don't get a response. When I look for emails containing Marjorie or Smith, I get a valid response. Is this how IMAP with exchange is supposed to work? Search on To works fine with email and labels.

Exchange Web Services Missing Interval Data for Yearly Recurrence

$
0
0

Hi,

I have found whilst developing against an on premises version of Exchange 2013 using Web Services the interval value for yearly appointments is not returned.

I used outlook to create a yearly appointment "on 1 June every two years" but when examining the Master Appointment using the Exchange Web Services API the Recurrence object doesn't expose the interval value.  I also inspected the XML returned by the server and it also didn't contain the interval value.  In this case i was expecting a value of 2.

Is there a way to determine the the interval value using the Exchange Web Services API for yearly appointments?

thanks


Exchange 2010 - interval is missing in Microsoft.Exchange.WebServices.Data.Recurrence.YearlyPattern

$
0
0

Hello everyone,

we currently work with appointments through the exchange web services. We have to handle recurring appointments as well, and everything works fine, except for appointments that occur in a yearly pattern.

When you create an appointment through a client like outlook, you are able to set an interval for a yearly recurring appointment. But this member is not included in the classes we have to work with through the web services: http://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.recurrence.yearlypattern_members(v=exchg.80).aspx

This is, because YearlyPattern is no subclass of IntervalPattern as every other patterntype is:

 http://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.recurrence(v=exchg.80).aspx

Does anybody know, what's the cause of this? Is there a chance to get the interval property? Is there possibly a workaroundwe can use?

Kind regards,

Kai Hartmann

WinRM Error : Get-PsSession/Enter-PsSession -ComputerName on Microsoft Exchange does not work

$
0
0

Hello,

I want to use the cmdlet "Get-PsSession -ComputerName"  and  "Enter-PsSession -ComputerName"  to  get and join a remote powershell session which connects my Windows server 2008 R2 to Microsoft Exchange server.

Well, i previously opened a "New-PsSession" to Microsoft Exchange with the method described in the online technet documentation (and this is working well)

$mycreds = New-Object system.Management.Automation.PSCredential("userlogin@mydomain.onmicrosoft.com", $passwordSecure)

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://ps.outlook.com/powershell/" -Credential $mycreds -Authentication Basic -AllowRedirection -Name $sessionName


ComputerName           : pod*****h.outlook.com
ConfigurationName      : Microsoft.Exchange
InstanceId             : 7fe3********0578c3
Id                     : 1
Name                   : mh*****bc1p6
Availability           : Available
ApplicationPrivateData : {SupportedVersions, ImplicitRemoting, PSVersionTable}
Runspace               : System.Management.Automation.RemoteRunspace
State                  : Opened
IdleTimeout            : 900000
OutputBufferingMode    : None
DisconnectedOn         :
ExpiresOn              :



But when i open a new Powershell window, i try to get the current PsSession this this cmdlet i got an error :

Enter-PSSession -ComputerName pod5****.outlook.com -UseSSL

(i think i need to use SSL because the connection URI ishttps://ps.outlook.com/powershell/, am i true?)


Error:

Connect-PSSession : The remote session query failed for pod5******.outlook.com with the following error message:
WinRM cannot complete the operation. Verify that the specified computer name is valid, that the computer is accessible
over the network, and that a firewall exception for the WinRM service is enabled and allows access from this computer.
By default, the WinRM firewall exception for public profiles limits access to remote computers within the same local
subnet.
At line:1 char:1
+ Connect-PSSession -ComputerName po******sh.outlook.com -UseSSL
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Manageme...nConnectionInfo:WSManConnectionInfo) [Connect-PSSes
   sion], RuntimeException
    + FullyQualifiedErrorId : WinRMOperationTimeout,RemotePSSessionQueryFailed,Microsoft.PowerShell.Commands.ConnectPS
   SessionCommand

 

Secondly, i tryed a Test-WSMan cmdlet, but i also got an error :

Test-WSMan -ComputerName pod51031psh.outlook.com

error:

Test-WSMan : <f:WSManFault

xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault"

Code="2150859046" Machine="FT2-AFR-DSYN-01.afr.corp.local"><f:Message>WinRM

cannot complete the operation. Verify that the specified computer name is

valid, that the computer is accessible over the network, and that a firewall

exception for the WinRM service is enabled and allows access from this

computer. By default, the WinRM firewall exception for public profiles limits

access to remote computers within the same local subnet.

</f:Message></f:WSManFault>

At line:1 char:1

+ Test-WSMan -ComputerName pod51031psh.outlook.com

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   + CategoryInfo         : InvalidOperation: (pod51031psh.outlook.com:Strin

  g) [Test-WSMan], InvalidOperationException

   + FullyQualifiedErrorId : WsManError,Microsoft.WSMan.Management.TestWSManC

  ommand



Why this error is happening ?

What can i do to join the existant PsSession ?

Does something need to be unlocked by Microsoft?

Is there another way  in powershell to re-use an etablished connexion to Exchange?

I hope you can help me, i really need some

Vincent Nunnari

Viewing all 7132 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>