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

[E2007,E2010,E2013] [EWSMA] [C#] [Windows]: Group Expansion Not Working for Hidden Group?

$
0
0

Hi,

I have some code that is reading through mailboxes and extracting in-box, Sent Items and Deleted Items data. In relation to Sent Items I am particularly interested in identifying how many people the user sent emails to. Initial versions of the application just read the message.ToRecipients collection.  This gave me the individual email addresses the user sent emails tom but I need to be more accurate and also work out if the recipient is a group.  I inserted the MSDN example code for group expansion and this seemed to be working fine and I was getting the groups expanded out to their individual member email addresses. I have noticed however that we have a couple of groups that are hidden from the normal lists and these two do not expand.

When I checked the code I found that the address.MailboxType was coming back as null?

I then decided that I couldn't test for a group using:

if(message.ToRecipients[o].MailboxType == MailboxType.PublicGroup
    || message.ToRecipients[o].MailboxType == MailboxType.ContactGroup
    || message.ToRecipients[o].MailboxType == MailboxType.PublicFolder
    )

So although it's messy I would assume all email addresses being processed are groups and when I then try and expand it and get an error I therefore assume it is a single mail address.

This doesn't work either as the group still doesn't expand and throws the same error as a single mail address so to all intents and purposes it appears to all the World as though it is a single mail address.  Is this a bug in the EWS Managed API?

This is the full block of code:

                            //TO  ==============================================
                            if (message.ToRecipients == null || message.ToRecipients.Count == 0)
                            {
                                //Do nowt!
                            }
                            else
                            {
                                for (o = 0; o <= message.ToRecipients.Count - 1; o++)
                                {
                                    //Check for distribution group.
TryAgain2:
                                    NumRetries = 0;
                                    try
                                    {
                                        grp = service.ExpandGroup(message.ToRecipients[o].Address);
                                        if (grp.Members.Count> 0)
                                        {
                                            foreach (EmailAddress address in grp.Members)
                                            {
                                                EmailTo tr = new EmailTo();
                                                tr.ToEmailAddress = ConvertLEDN(address);
                                                if(paramCN==null)
                                                    tr.AddRecord(0,false, d.DataExtractTableID,ref cn);
                                                else
                                                    tr.AddRecord(0, false, d.DataExtractTableID, ref paramCN);
                                                tr.Dispose();
                                            }
                                        }
                                        else
                                        {
                                            EmailTo tr = new EmailTo();
                                            tr.ToEmailAddress = ConvertLEDN(message.ToRecipients[o].Address);
                                            if (paramCN == null)
                                                tr.AddRecord(0, false, d.DataExtractTableID, ref cn);
                                            else
                                                tr.AddRecord(0, false, d.DataExtractTableID, ref paramCN);
                                            tr.Dispose();
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        if(ex.Message == "No results were found.")
                                        {
                                            EmailTo tr = new EmailTo();
                                            tr.ToEmailAddress = ConvertLEDN(message.ToRecipients[o].Address);
                                            if(paramCN == null)
                                                tr.AddRecord(0, false, d.DataExtractTableID, ref cn);
                                            else
                                                tr.AddRecord(0, false, d.DataExtractTableID, ref paramCN);
                                            tr.Dispose();
                                        }
                                        else
                                        {
                                            timer1.Enabled = true;
                                            int c = 0;
                                            do
                                            {
                                                c++;
                                                if (c % 1000 == 0)
                                                {
                                                    Application.DoEvents();
                                                }
                                            } while (TimeElapsed == false);
                                            timer1.Enabled = false;
                                            NumRetries++;
                                            if (NumRetries <= 20)
                                            {
                                                goto TryAgain2;
                                            }
                                            else
                                            {
                                                string msg = "Last error message was:" + Common.NNL + ex.Message + Common.NNL + "Press Yes to try again." + Common.NL + "Press No to save the data file and end the program.";
                                                PEH("GetMailData", "frmDataCollector", "Error in GetMailData Group Expansion in To Recipients with greater than 20 request failed errors, server may be offline?");
                                                if (MessageBox.Show(msg, Common.H, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.No)
                                                    Environment.Exit(0);
                                                else
                                                    goto TryAgain2;
                                            }
                                        } // if(ex.Message== "No results were found.")
                                    } // End of Catch block
 
                                }  // End of for (o = 0; o <= message.ToRecipients.Count - 1; o++)
                            } // End of if (message.ToRecipients == null || message.ToRecipients.Count == 0)

Siv


Graham Sivill - Martley, Worcester. UK



How to get Microsoft.Exchange.WebServices.Data.Item.ID from Outlook.MailItem?

$
0
0

Hello,

My users drag and drop email message from Outlook onto my desktop app. I need to get this message from exchange and move/manipulate it.

The fastest way I found to get a message from Exchange with EWS API is by binding to ItemID

EmailMessage.Bind(exchangeService, new ItemId(exchangeMessageID))

Can I get this ItemId.UniqueID from Outlook.MailItem object?

Thank you!


Isolda

Exchange server 2010 Managemnet Console

$
0
0

Hi Everyone,

i need help. i have installed exchange 2010 on a new server which is the second exchange server in my organization. installation finished and installed SP1 properly. now when i open MMC it gives me the below error. i checked online and got an solution of adding of adding exchange forest which i tried now got another error which is below the first error.

Kindly HELP ME PLEASE.

Regards

Yusuf Kamruddin

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 EWS URL outlook.office365.com/.../services.wsdl 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?

I got around this by hosting my own copy of the WSDL and adding the service definition myself: 
<wsdl:service name="ExchangeWebService">
<wsdl:port name="ExchangeWebPort" binding="tns:ExchangeServiceBinding">
      <soap:address location="...outlook.office365.com/EWS/exchange.asmx" />
</wsdl:port>
</wsdl:service>

EWS: save new appointment in shared calendar

$
0
0

I am in the process of changing an application to EX2013. The previous installation used EX2007 and a public folder calendar to keep appointments.

AFAIK in EX2013 shared mailboxes should be used for common access to mails/appointments necessary fro more than one people, such as the famous "info@..." account.

In fact I have not only to concentrate emails but also keep appointments in this shared mailbox.

My problem now is that my VB.NET code saves the appointment always in the calendar of the user which is logged in, not to the shared mailbox.

AFAIK a "normal"mailbox is associated with a AD user with login-name and password, while the shared mailbox has no user with a password to  log in.

Dim retFolderID As Microsoft.Exchange.WebServices.Data.FolderId

            ss.Credentials = New System.Net.NetworkCredential(user, passwd)

ss.AutodiscoverUrl(user)

'now the pyhsical user should be logged in

'this is the new code which should lead to the shared calendar
 Dim mb = New Microsoft.Exchange.WebServices.Data.Mailbox("info@domain.local")
            Dim fID = New Microsoft.Exchange.WebServices.Data.FolderId(WellKnownFolderName.Calendar, mb)

            Try
'Is this correct?
                retFolderID = fID

'This is the old code used for the publicfolder
                'retFolderID = Microsoft.Exchange.WebServices.Data.Folder.Bind(ss, fID)
            Catch ex As Microsoft.Exchange.WebServices.Data.ServiceRequestException

May be my mistake comes later when I bind a service to a new Appointment ...

Dim zz As New Microsoft.Exchange.WebServices.Data.Appointment(ss)

With this I don't have a line where the above folder or folderid is used.

Can anybody giv me some hints ?

EWS Powershell: Set HomePageURL

$
0
0

I'm so close its frustrating

Building a powershell app to add a folder to a mailbox and set it with a homepage. I can create the folder and my code below sets the PR_FOLDER_WEBVIEWINFO property, but its not setting the correct value. If looking at MFCMapi the value I'm setting appears under "Value (alternative text)" rather than "Value".... 

Here's the code, the $Encoded URL value is valid as if I input this directly into MFCMapi then the 'homepage' appears...  

 

$EncodedURL = "020000000100000001000000000000000000000000000000000000000000000000000000000000002000000068007400740070003A002F002F00620069006E0067002E0063006F006D000000"
$bqByteArray = [System.Text.Encoding]::ASCII.GetBytes($EncodedURL)
$PR_FOLDER_WEBVIEWINFO = new-object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(14047,[Microsoft.Exchange.WebServices.Data.MapiPropertyType]::Binary)
$NewFolder.SetExtendedProperty($PR_FOLDER_WEBVIEWINFO,$bqByteArray)
#
$NewFolder.update()

It's almost as if my $EncodedURL should be the byte array, but if I try to use

$NewFolder.SetExtendedProperty($PR_FOLDER_WEBVIEWINFO,$EncodedURL) it just fails.... A little guidance please

Error enable hybrid exchange 2013

$
0
0

to try to enable the hybrid environment the following error is displayed:

[12/15/2015 19:17:01]   ERROR : System.Management.Automation.RemoteException: Can't read all of the recipient objects that you want to update update using LDAP recipient filter "(mailNickname=*)" of object "EmailAddress". The following exception occurred: Active Directory operation failed on ROKU.ds.iteso.mx. Additional information: Active Directory rejected paged search cookie because a cookie handle was discarded by a Domain Controller or a different LDAP connection was used on subsequent page retrieval. Paged search needs to be restarted and will succeed.
                                Additional information: The parameter is incorrect.
                                Active directory response: 00000057: LdapErr: DSID-0C090753, comment: Error processing control, data 0, v1db1.
[12/15/2015 19:17:01]    INFO : Session=OnPrem Cmdlet=Update-EmailAddressPolicy FINISH Time=48061.8472ms
[12/15/2015 19:17:01]   ERROR : Subtask Configure execution failed: Configure Recipient Settings
                                Execution of the Update-EmailAddressPolicy cmdlet has thrown an exception. This may indicate invalid parameters in your hybrid configuration settings.
                                Can't read all of the recipient objects that you want to update update using LDAP recipient filter "(mailNickname=*)" of object "EmailAddress". The following exception occurred: Active Directory operation failed on ROKU.ds.iteso.mx. Additional information: Active Directory rejected paged search cookie because a cookie handle was discarded by a Domain Controller or a different LDAP connection was used on subsequent page retrieval. Paged search needs to be restarted and will succeed.
                                Additional information: The parameter is incorrect.
                                Active directory response: 00000057: LdapErr: DSID-0C090753, comment: Error processing control, data 0, v1db1.
                                   at Microsoft.Exchange.Management.Hybrid.RemotePowershellSession.RunCommand(String cmdlet, SessionParameters parameters, Boolean ignoreNotFoundErrors)
[12/15/2015 19:17:01]    INFO : Task='Configure Recipient Settings' Step='Configure' FINISH Result=False Time=51680.2972ms

EWS C# : inline attachments not redering correctly

$
0
0

when sending mail messages to faxination using outlook api the inline (Signature images) are correctly embedded in the generated tif.

when doing the same with ews managed api, a separate page is created for each inline (image) attachment


Office 365 EWS: CreateItemRequest with MessageDisposition of SaveOnly does not return meeting response.

$
0
0
We are using Exchange Web Services on one of our Office 365 Mailboxes to automatically respond to incoming meeting invitations.

In some cases, our business logic requires us to reply to a meeting request with a counter-proposal message. As the EWS Managed API does not support this as of yet, our current workaround is:

- Save the response message by using the AcceptMeetingInvitationMessage.Save() method on an AcceptMeetingInvitationMessage object created by a call to the Appointment.CreateAcceptMessage method - which equates to an EWS call to CreateItem with an AcceptItem as the item to create and MessageDisposition set to SaveOnly.
- Reload the saved item as returned by the MeetingResponse-Property of the CalendarActionResults object returned by .Save() - which equates to the MeetingResponse item returned as part of the CreateItemResponseMessage in EWS.
- Set the properties required for the counter-proposal on the item manually and sending it.

This works perfectly on all of our on-premises Exchange instances. However, accessing Office 365 via EWS, the CreateItemResponse returned by the CreateItem request only returns the CalendarItem the meeting request pertains to. It does not return the MeetingResponse, which renders the workflow described above impossible.

As I understand, EWS is supposed to be backwards-compatible with older versions, which brings me to the conclusion that the behavior described above might be a bug in the Office 365 implementation of EWS, as the same type of request under the same conditions does not yield the same result on our on-premises servers as it does with Office 365.

Is this a bug in Office 365? I have already contacted Office 365 support - however, the reply was unfortunately less than helpful.

Thanks!

How can I redirect a user to an Office 365 contact page?

$
0
0

Anyone know how I can redirect a user to an Office 365 contact page? I have the Exchange object ID from exchange web services. I can do this in the desktop Outlook app easily, but want to do this on the web. I would rather not have to consume all the contact information and build my own contact page.

James

Problems with Exchange database recovery

$
0
0

Guys, I'm looking for a little help.  Last Wednesday, we had a UPS failure that triggered a dirty shutdown of Exchange.  I run two 64-bit servers on the backend for mailboxes (one for Students and one for Faculty/Staff).  The Fac/Staff box came up fine with no issues.  The student server is another story.  By the way, our backups were not valid so I can't go that direction (another story another day). When it came back up, there were two storage groups with databases that would not mount.  My storage groups and DB's are arranged by year, so the 2010-11 and 2011-12 mailstores were the ones affected.  After following several threads and links here, I was finally able to recover and restore the 2011-12 SG and mailstore. It is fine.  A couple of passes with eseutil to repair and defrag. Attempted the same process on the 2010-11 box.  At first, all seemed OK.  But we started getting reports from students that messages in their accounts were empty or they couldn't access it at all after logging in via OWA.  I ran the database recovery tool under EMC and it fixed a handful, but others remained problematic.  Now it appears that it hasn't completed the recovery due to lack of disk space.  I now have three .edb files with a Temp#### prefix.  The current 2010_11.edb file is 42GB in it's current storage group.  The temp edb files are scattered randomly across other drives. Question:  Are all 3 needed for a full recovery?  They are 40GB, 30GB, and 7.5GB in size.  I'm assuming that they are all from the same 2010_12.edb file, but stopped in various stages of repair/defrag due to lack of drive space.  Should I re-run eseutil /d against them all or what do you advise?  I know I need 110% of free space to run the tool through it's completion. I'm heading out for a few hours but will check back in later tonight.  Thanks in Advance!

Best method to send on behalf of ....

$
0
0

This is a .Net MVC web site. 

It needs to send an email on behalf of the user. It then needs to save the email in the Sent Items folder of a email group that the user has access to.

I have looked into Impersonation, but that is probably not realistic in our corporate environment.

Send 'on-behalf-of' is also not useful as it does not give any folder access.

Is there any other method?

Thanks,

Sam Bilbrey


SendAndSaveCopy fails with ErrorMissingEmailAddress when connecting as user without a mailbox and sending email with attachment

$
0
0

I'm using C# EWS Managed API and when I try to send an email using SendAndSaveCopy() with an attachment it fails if I'm connecting using windows auth as a user without a mailbox. I'm specifying the FolderId to save to so I'd expect it to work, but I get an error with code ErrorMissingEmailAddress: When making a request as an account that does not have a mailbox, you must specify the mailbox primary SMTP address for any distinguished folder Ids.

Looking at the EWS trace I see the call to SendAndSaveCopy() is first issuing a call with <m:CreateItem MessageDisposition="SaveOnly"> and that fails. I'm connecting using windows authentication using a service account, which doesn't have a mailbox, and then interacting with a particular mailbox. Using windows auth and a service account is a customer requirement in their environment. If instead I connect using username & password authentication, in my test environment, I SendAndSaveCopy() issues two EWS calls: the first has <m:CreateItem MessageDisposition="SaveOnly"> and does not specify a SavedItemFolderId. It gets a response with the ItemId of the message and attachments, and the second call has <m:SendItem SaveItemToFolder="true"> and includes a <m:SavedItemFolderId> of the SentItems folder. 

Is this a known problem with SendAndSaveCopy()? How should I call the EWS Managed API to correctly send an email with an attachment and save it to the SentItems of a particular mailbox? 

If I'm to call CreateItem() and then call SendItem(), should I tell CreateItem() to save to Drafts or to Sent Items? I see this slightly cryptic message in theSendItem docs "If an item in the Sent Items folder is sent, the sent item is deleted and a copy of it is put in the Sent Items folder." My concern with saving to SentItems is if the subsequent call to SendItem() fails I'll be left with an item in Sent Items that appears to have been sent but actually hasn't. If I instead save to Drafts is the item automatically removed from there when I call SendItem() and tell it to save to the SentItems folder? 

Thanks for any pointers,

Rory

I also posted this question on Stack Overflow.

How can I get a modified occurrence by using EWS API Finditems operation or other operations?

$
0
0
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header><t:RequestServerVersion Version="V2_75" /></soap:Header><soap:Body><m:FindItem Traversal="Shallow"><m:ItemShape><t:BaseShape>IdOnly</t:BaseShape><t:AdditionalProperties><t:FieldURI FieldURI="item:Subject" /><t:FieldURI FieldURI="item:LastModifiedTime" /><t:FieldURI FieldURI="calendar:UID" /></t:AdditionalProperties></m:ItemShape><m:SortOrder><t:FieldOrder Order="Ascending"><t:FieldURI FieldURI="item:LastModifiedTime" /></t:FieldOrder></m:SortOrder><m:Restriction><t:IsGreaterThanOrEqualTo><t:FieldURI FieldURI="item:LastModifiedTime" /><t:FieldURIOrConstant><t:Constant Value="2015-12-21T00:00:00" /></t:FieldURIOrConstant></t:IsGreaterThanOrEqualTo></m:Restriction><m:ParentFolderIds><t:DistinguishedFolderId Id="calendar" /></m:ParentFolderIds></m:FindItem></soap:Body></soap:Envelope>

I am using this soap request to sync the calendar items from Exchange server to local app. When I started to handle recurring items, I found that after I edited an occurrence of a recurring item, this soap request only returns the recurring item instead of modified occurrence.

I have tried to using the ModifiedOccurrences, but this approach is not efficient. The ModifiedOccurrences can tell me all modified occurrences, but I still don't know the latest modified occurrence.

Please help me on this one. Thank you.

EWS update appointment while using impersonation fails saying that access is denied

$
0
0

Hi, I have the following issue and I was hoping that someone here could help me with this. I am developing an app where I use soap requests to communicate with the EWS, so fyi I am not using the EWS Managed API, but just pure EWS. 

So when I create an event via my app, using impersonation (I use a service account X that impersonates a user Y, since I want to create the event in the Y user's calendar) it works well. When I try to update the event I created via my application also using impersonation like above, it works fine. However if I log on to office 365 online, and go to user Y's (impersonated user) calendar and create an event there, and then go into my app, pull the current bookings from his calendar and try to update one of those pulled bookings that were created in the online calendar, I get the access is denied error, specifically this:

('Access is denied. Check credentials and try again., Microsoft.Exchange.Data.Storage.AccessDeniedException: Cannot get ID from name.)

Now this does not make sense to me because I am doing the same thing when I create the event from my application and from the calendar. When I create the event from my app I am using the service admin account to impersonate the user and create the event in his calendar, and when I create the event in the calendar I go to that user's calendar and create an event. To me that sounds like the same thing, right? 

Then I tried another solution. Since there will always be a room involved in the event creation process, I tried only fetching the room events, and creating events on the room calendars for specific users, and then adding them as owners or participants. It also works well from my app, but if I create an event from the office calendar for a specific user and room, and if I try to update that event after I pull it into the application, there is no error, but the event only gets updated in the room's calendar, it does not send a notification that the event is updated to the owner's or the participant's calendar, so their event remain the same.

Any help is appreciated..


Can't cancel meeting on Exchange Server 2010 (EWS Managed API)

$
0
0

Hi everyone,

I'm trying to cancel meetings with the code below but can't manage it. The thing is I have enough permission to cancel someone else's meetings on Outlook but can't do it with EWS API. When I try to cancel meetings, I got "User must be an organizer for CancelCalendarItem action." error.

FolderId calendarId = new FolderId(WellKnownFolderName.Calendar, "xxx@domain.com");

CalendarView cView = new CalendarView(firstDayOfWeek, firstDayOfWeek.AddDays(28));
cView.PropertySet = new PropertySet(BasePropertySet.FirstClassProperties);

FindItemsResults<Appointment> appointmentResults = service.FindAppointments(calendarId, cView);

appointmentResults.ElementAt(0).CancelMeeting();

So, can you guys tell me what the problem is?

Ali COŞKUN

Mail Flow issue in Exchange Server 2013

$
0
0
I am getting below issue . I can send mails to other domain , But i am unable to receive other domain mails.
Remote Server returned '550 5.7.1 TRANSPORT.RULES.RejectMessage; the message was rejected by organization policy'

High memory usage

$
0
0

Hello, we have a 2012 R2 server with Exchange 2010 standard and 32GB of memory. The store.exe uses over 16GB of ram. At the end of the day, when all users are gone and disconnected from Exchange the usage stays the same. Why will it not reduce down? After restarting the information store services the memory allocated is on 175mb. Is this expected? Any feedback appreciated.

Thank you

How to export calendar items to csv-file with powershell

$
0
0

Hi guys, 

Does anyone know how to export calendar items, from a specific user to a CSV-file with a Power Shell script? 

Example: 

How do I export all calendar items from the mailbox jordi@domain.com to a CSV-file with a Power Shell script? 

Thanks for you support! 

Kind regards, 

Jordi Martin Lago 

SSL Certificate from Azure to test Exchange 2013 Hybrid

$
0
0

I am using a Windows Azure VM and have installed Exchange 2013 on it as well.
I however want to test the Exchnage 2013 hybrid features which would require 3rd party certificates.

Can Windows Azure help with SSL certificates for the same.

Thanks in anticipation

Dhrub Sagar


Dhrub Sagar

Viewing all 7132 articles
Browse latest View live


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