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

The expected XML node type was XmlDeclaration, but the actual type is Element.

$
0
0
Hello,

I am new to EWS. I created a C# application which syncs contacts from a database to Exchange using EWS Managed API. This app works great on PCs which are connected to our physical network/domain. Now, I am trying to make it work for remote PCs (which are not directly connected to the domain). The AutoDiscover call returns an error "The expected XML node type was XmlDeclaration, but the actual type is Element." 

Here is my code

private ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
try
{
	service.Credentials = new NetworkCredential("test.user", "password", "mycomp.com");
	service.AutodiscoverUrl("test.user@mycomp.com", RedirectionCallback);
}
catch (System.Exception e)
{
	sErr = e.Message;
}
I have also tried using WebCredentials but I get the same error. Fiddler does not give my any useful information. Any idea what I am doing wrong? Your help is greatly appreciated.

Thanks.
Vishnu





EWS Managed API setting Internet Message Headers

$
0
0
I am trying to create an application that will add email messages into my Exchange server, but I am running into issues setting headers on the email message I am creating. My code is as follows:

ExchangeService es = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
es.UseDefaultCredentials = false;
es.Credentials = new WebCredentials("Administrator", "1234567890", "xyz.com");
es.Url = new Uri("https://omega.xyz.com/EWS/exchange.asmx");

EmailMessage em = new EmailMessage(es);
em.SetExtendedProperty(new ExtendedPropertyDefinition(DefaultExtendedPropertySet.InternetHeaders, "Received", MapiPropertyType.String), ": by 10.204.65.207 with SMTP id k15cs110962bki;\n         Wed, 2 Sep 2009 13:26:19 -0700 (PDT)");

em.Subject = "TESTING";
em.From = "dave@xyz.com";
em.ToRecipients.Add("test@xyz.com");
em.Save(WellKnownFolderName.Inbox);

For now I'm just using a sample header I have taken from a real email message, to test the code out. Once the email is saved, I am able to view it in outlook, but when I view the message properties, the Internet Headers field is blank.

The aim behind this application is to pull email messages from various other accounts and insert them into my exchange server. There are other applications out there that do this and submit to Exchange via SMTP, but this results in the headers being changed, and I wish to keep the headers intact in my Exchange server. My current work-around to this is running Outlook on my server, obviously this is far from optimal.
www.dlpwd.co.uk

Exchange 2010 crashed

$
0
0

Dear All

One of our client was using messaging environment in MS Exchange 2010  with one mailbox server and CAS server.

They informed that mailbox server has crashed due to hardware problem and they have database backup in.edb.

Now we are going to install Exchange 2013 with one Mailbox Server and one CAS server.

How can get old mailboxes and how can manage it.

Regards

Ashraf


Ashraf

[E2013][EWS][EWS-XML]Setting meeting attendee status

$
0
0

I have asked this question before (it appears what I want to do is impossible) but thought I would ask again in case there is any new capability or new insight from anybody.  I am using EWS/XML to create calendar entries.  If a meeting has attendees, I am setting them by using <t:RequiredAttendees>, <t:Attendee>, <t:Mailbox>, <t:Name>, <t:EmailAddress>.  I would like to set the status (confirmed, declined, tentative) by using <t:ResponseType> but of course this is a read-only property, so trying to set it causes a failure.  I know that I can re-send meeting invitations and I do that as a work-around, but this is a migration application and I really would prefer to create an existing calendar entry with all properties set.  Does anybody have any suggestions?  I have thought about using extended MAPI properties to set PR_RECIPIENT_TRACKSTATUS in the recipient table but I would need some sample code to understand how to do that in XML.  Any help appreciated.

EWS API to get shared calendars "Other Calendars"

$
0
0

Guys , I've been struggling to get the Shared calendar details using EWS API (Java ) .

I am new to Exchange Web service .

Here is the scenario.

We have "SHA" , A , B & C users. The users A,B & C has shared their calendar to 'SHA' user with all permissions and and also edit too. So that the calendars of A,B & C is displaying in the SHA calendar as "Other Calendars" .

I am trying to get the appointment details of these calendars through SHA user by using EWS API (Java based) . i tried all the possible scenarios and googled but no luck . 

Please help to resolve this and also we dont want to have any "Shared MailBox" concept.

And also i know A/B/C mail ids shared with SHA.

I tired like the below code but no luck.

ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
        ExchangeCredentials credentials = new WebCredentials("sha@xxxxx.onmicrosoft.com", "xxxxxxxx");
        service.setCredentials(credentials);
        service.setUrl(new URI("https://outlook.office365.com/EWS/Exchange.asmx"));

service.findAppointments(new FolderId(WellKnownFolderName.Calendar, Mailbox.getMailboxFromString("a@xxxxx.onmicrosoft.com")), new CalendarView(startDate, endDate));

Highly Appreciated if any could help with any sample source in JAVA.

I am using Office 365 web app and subscribed Office 365 business Premium.

 



Turn off Outside of my Organization tab in outlook 2013

$
0
0
Hi All - Please assist me to turn off outside of my organization tab in outlook 2013 and keeping just the inside my organization tab. I'm trying to disable that feature in outlook to all client running outlook 2013. Is it possible to setup a group policy in exchange server side to disable that feature that will disable that feature in outlook 2013 client. Any guidance will be appreciated. 

Configure outlook to block out of office messages to external email accounts

$
0
0
Hi All - Please assist to configure outlook to block external email account.

Get file Hash (MD5/SHA256) via EWS API without copying the physical files out of Exchange

$
0
0

We are looking for a way to get attachment's file hash from Exchange without having to copy the physical files themselves out of Exchange in order to do this. We have access via EWS API to both Exchange On premise and Exchange Online (O365). I have heard it is possible though could not find any documentation.

Our application uses EWS API and need to scan the mail-store for example: all emails in marketing group that have doc files attached and return the file hashes.

Any solution how to get file hash from Exchange?


Need help for retrieving Rules on Public folders

$
0
0

Hi everyone,

we recently migrated from Exchange 2007 to Exchange 2013. We also migrated our Public Folders database, which of course grew over time.

We are now trying to track all Public Folder rules which had been created by users on the Public Folders via Powershell or C#.

However as of today I am unable to even check if rules exist on a Public Folder. The HasRules property, introduced with Exchange 2010 has been removed in 2013.

Does anybody have any advice for me, how we can achieve this Task?

Best regards

Stefan

Is a Change password process on OWA the same as ChangePassword method of System.DirectoryServices ?????

$
0
0

Hi all,

I am wondering whether Change password method as figure shown in below  is the same as  ChangePassword method of System.DirectoryServices  or not.

I post sample code as well. below code is pretty straightforward to change password.

It is able to do both active user and expired password user.

    static void Main(string[] args)
        {

            string ldap = "LDAP://spxdev.local";
            string strUserName = "william";
            string strOldPassword = "P@ssw0rd";
            string strNewPassword = "W!11Li@m#123";
            string domain = "spxdev.local";

            XChangeMyPassword(ldap, domain, strUserName, strOldPassword, strNewPassword);


        }


 public static void XChangeMyPassword(string ldap, string domainName, string userName, string currentPassword, string newPassword)
        {
            try
            {
                string ldapPath = ldap;
            //   DirectoryEntry directionEntry = new DirectoryEntry(ldapPath, domainName + "\\" + userName, currentPassword);
               DirectoryEntry directionEntry = new DirectoryEntry(ldapPath, domainName + "\\" + "administrator", "P@ssw0rd");
                if (directionEntry != null)
                {
                    DirectorySearcher search = new DirectorySearcher(directionEntry);
                    search.Filter = "(SAMAccountName=" + userName + ")";
                    SearchResult result = search.FindOne();
                    if (result != null)
                    {
                        DirectoryEntry userEntry = result.GetDirectoryEntry();
                        if (userEntry != null)
                        {userEntry.Invoke("ChangePassword", new object[] { currentPassword, newPassword });
                            userEntry.CommitChanges();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

The main problem is that I cannot change password of expired user through   OWA , instead  Above code is successful.

 Thank a lot

John



[Exchange-Online] [EWS] [C++][Windows] EWS Redirection,forwarding Throttling on transport rules

$
0
0

Hello,
I have some questions regarding throttling on office 365.
I have a request to build an appliaction that makes statistical processing on every incoming mail to the organization.
I'm planning to create a new "centralized" mailbox that will recieve all the incoming emails from outside the organization.
I will run some statistics on them (with an EWS appliaction that will be connected to this mailbox) and then return
them back to the original recipients (Currently inline without a BCC)

I plan to implement it by creating a new Transport Rule on the exchange server level that will redirect all the emails
to the centrailized mailbox.
Then with an EWS client appliaction that listens to the mailbox on a streaming notifications, I will get the emails, process them and
return them back to the recipeints by using the EWS Send operation (Suppose i have a way to bypass the redirection loop)

My question is about the throtteling restrictions , assuming that I have a lot of mailboxes in the organization:

1) Does these restrictions hold when dealing with Transport Rules? If the transport rule is on the exchange level,
who is the mailbox that consumes the ForwardeeLimit,RecipientRateLimit limits?
2) Does the Send operation from the EWS client consumes the MessageRateLimit budget?
3) Is there any documentation about the office 365 default throttling values?
4) Does any other good option to implement such thing besides monitoring every mailbox using impersonation?

Thanks alot!

significance of MIMETruncation: '1', MIMESupport: '0' in a single sync request

$
0
0

Hi,

I am developing a test exchange activesync server for email synchronization on mobile devices.

In a sync request from one of the mobile device (iPhone) I am getting sync request as shown below:

{ FilterType: '3',
  MIMETruncation: '1',
  MIMESupport: '0',
  BodyPreference: { _ns: 'AirSyncBase', Type: '1', TruncationSize: '500' } }

I am bit confused about this request; if MIMESupport is set to '0' then what is the significance of sending  MIMETruncation as '1' in the Sync request. Also in BodyPreference requesting 'text' type with Truncation size 500.

Can you please help me understanding the request and possible response for it.

Thanks in advance.

[E2010] [C#] [Windows] Resolving SMTP addresses from EX addresses

$
0
0

Hi,

I am trying to get the SMPT addresses from EX type addresses in an Outlook add-in. Note that Outlook is connected to Exchange using Online Mode. Currently using Recipient.AddressEntry.PropertyAccessor.GetProperty(PR_SMTP_ADDRESS) in C# for each recipient from the ItemSend event in Outlook. However, when sending to many recipients this causes many Exchange RPC requests which causes slow performance.

Is there a way to resolve email addresses from EX type addreses (EX=legacyExchangeDN) in bulk in one single call to Exchange to improve the speed?

I know of another product that still manages to resolving recipient emails individually using a method that causes a GetProps event on the Exchange side, instead of my way which causes an QueryRows event (which is slower). Not sure if anyone has any idea what these two different events mean and if you have any idea of what this other product could be doing differently.



EWS Time Zone settings

$
0
0

Hello everyone, I need some information.

 I have to synchronize tasks with Exchange, from another platform with the possibility of having different time zones.

 I found the settings surfing the net for Italy: 
 class EWSWrapper:
    '''Provides an interface for an Exchange server.'''
    #Time Zone settings
    BaseOffset      = "-P0DT1H0M0.0S"
    Offset      = "-P0DT1H0M0.0S"
    DaylightTime    = "02:00:00.0000000"
    StandardOffset  = "P0DT0H0M0.0S"
    StandardTime    = "03:00:00.0000000"
    TimeZoneName    = "(GMT+01:00) Warsaw"
    TimeZoneId      = "Central European Standard Time"
    #for pagination purposes (search / sync)

If exchange server has a different timezone, for example UTC, it's possible to find or calculate settings?

https://gist.github.com/philippkeller/5175842

[ExchangeOnline][Powershell]Problem removing calendar permissions for a deleted user in office 365

$
0
0

I asked this question in the Powershell subreddit today but am trying to get closer to people who specialize in this area. Please move if I didn't pick the appropriate forum.

I have a user Suzie who gave user Anita reviewer permission on her calendar (not their real names). Anita subsequently left and her Office 365 mailbox was deleted before removing permissions from Suzie's calendar. Now when I try to change or remove her permissions, I get this error:

Remove-MailboxFolderPermission -identity sjames -user aclark -confirm:$false

There is no existing permission entry found for user: aclark.
    + CategoryInfo          : NotSpecified: (:) [Remove-MailboxFolderPermission],
      UserNotFoundInPermissionEntryException

The help for Remove-MailboxFolderPermission says the User parameter can be any of

Name
Display name
Alias
Distinguished name (DN)
Canonical DN
Email address
GUID

I've tried all forms of Anita's name and email address. I even cobbled together the DN format of her name. All give the above error or ones like below:

The user "aclark@company.com" is either not valid SMTP address, or there is no matching information.+ CategoryInfo          : NotSpecified: (:) [Remove-MailboxFolderPermission],
       InvalidExternalUserIdException

There is still an MsolUser record for Anita, but it seems to be trying to validate the name against mailbox info which is gone. It doesn't show a DN or CN format or a GUID.

Does anybody know of any other way to delete the entry?


Problem: Edit email created by API using outlook

$
0
0

Hello!

i try to explain my situation, i create a mailmessage in this way:

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        Dim service As New ExchangeService()
        service.Credentials = New Net.NetworkCredential("email@email.it", "<MyPassword>", "myDomain.it")
        service.Url = New Uri("https://outlook.office365.com/ews/exchange.asmx")

        Dim message As New EmailMessage(service)
        message.From = New EmailAddress("email@email.it", "email@email.it")
        message.Subject = "TEST_1"
        message.Body = "Test exchange Defer mail"
        message.ToRecipients.Add("andrea_xxxx@hotmail.com")

        Dim PR_DEFERRED_SEND_TIME As New ExtendedPropertyDefinition(16367, MapiPropertyType.SystemTime)

        Dim dtAppo As DateTime = Now.AddSeconds(30)
        Dim sendTime As String = dtAppo.ToUniversalTime.ToString("o")

        message.SetExtendedProperty(PR_DEFERRED_SEND_TIME, sendTime)message.Save(WellKnownFolderName.Drafts)

       message.Save(WellKnownFolderName.Draft)
       message.SendAndSaveCopy(WellKnownFolderName.SentItems)


        Me.Close()

    End Sub

I can edit it using Outlook

but when exchange sends the email (30 sec deffered) is sent without any changes made by the editor of outlook.

it seems that I edit a copy and not the email exchange that sends

<o:p>Andrea</o:p>

syncfolderItems is not giving up to date sync state for deleteditem folder

$
0
0

Hi,

I am trying to get the up to date syncsate of deltined item folder of a mailbox and its being filtered on the basis of a specific time.

here is my code

ry
                    {
                        //Get a list of changes(up to MAX_CHANGES) that have occurred on normal items in the Inbox folder since the prior synchronization.
                      List<ItemId> itmid = new List<ItemId>();
                        if (syncStateObject.syncState == null)
                        {
                            DateTime startDate = DateTime.Now.AddYears(-2); //start from two years earlier
                            DateTime endDate = DateTime.Now.AddDays(-1);
                            var itemView = new ItemView(500, 0);
                            itemView.PropertySet = new PropertySet(BasePropertySet.IdOnly,
                                ItemSchema.Subject, AppointmentSchema.Start, AppointmentSchema.End);

                            var filter = new SearchFilter.SearchFilterCollection(LogicalOperator.And,
                                new SearchFilter.IsEqualTo(ItemSchema.ItemClass, "IPM.Appointment"),
                                new SearchFilter.IsGreaterThanOrEqualTo(AppointmentSchema.Start, startDate),
                                new SearchFilter.IsLessThan(AppointmentSchema.Start, endDate));

                            bool moreAvailable = true;
                            while (moreAvailable)
                            {
                                FindItemsResults<Item> appointments = service.FindItems(getWellKnownFolderName(folder), filter, itemView);
                                foreach (var item in appointments)
                                {
                                    itmid.Add(item.Id);

                                }
                                itemView.Offset += itemView.PageSize;
                                moreAvailable = appointments.MoreAvailable;
                            }

                        }

                        icc = service.SyncFolderItems(new FolderId(getWellKnownFolderName(folder), syncStateObject.siteMailBox), PropertySet.FirstClassProperties,
                            itmid.Count > 0 ? itmid : null , MAX_CHANGES, SyncFolderItemsScope.NormalItems, syncStateObject.syncState);

Please note that firts time syncobject.syncSate will be null for first time

now when i run above code for calendar folder it gives me the up to date sync state in one go, but for deleteditem folder it gets the list of itemid to be ignored, but it keep looping for long time. my mailbox is less than two year old so i am sure timespan i am giving is enough to get the list of all the ids.

Can anybody point what i am doing wrong here?

Thanks

How to send each message in Ques

$
0
0

Hi

My code is as follows

 foreach (DataRow row in dt.Rows)
  {

MailMessage depotmsg = new MailMessage();
                string FromMail = GetValueFromINI("FromEmail");
                depotmsg.From = new MailAddress(FromMail, "myname");
                depotmsg.Subject = "Expiry date reminder";
                depotmsg.To.Add(new MailAddress(_email, _depotname));
                depotmsg.IsBodyHtml = true;
                SmtpClient client = new SmtpClient();
                client.UseDefaultCredentials = false;
                client.Credentials = new System.Net.NetworkCredential(username, PassWord);
                string port = GetValueFromINI("Port");
                client.Port = Convert.ToInt32(port); // You can use Port 25 if 587 is blocked (mine is!)
                string host = GetValueFromINI("Host");
                client.Host = host;             

                client.EnableSsl = false;
                string htmlString = getHtml(newDS);
                depotmsg.Body = htmlString;

                try
                {
                  client.DeliveryMethod = SmtpDeliveryMethod.Network;
                   // client.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
                   // client.PickupDirectoryLocation = @"E:\temp\email";
                    client.Send(depotmsg);

                    
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Not Send ");
                }
  }

While running the  program , the error message " The server response was: 4.4.2 Message submission rate for this client has exceeded the configured limit ."

But while debugging the program  all the email  will go without error message. I used the following method 

client.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
client.PickupDirectoryLocation = @"E:\temp\email";

But  after that,  no error is coming but the mail not sending from E:\temp\email . 

Why all mail going fine while debugging  but error message is coming while running exe . What is the solution for that.

Is it good solution to give the code to  wait for a few second after sending each mail please anybody can advise me.

Please help with a solution, it would be very appreciate.

Regards


polachan

xport laptop and desktop details which have cached exchange mode enabled

$
0
0

Hello,

Environment is exchange 2010 SP3 RU13

Is it possible to generate a report with laptops , users having cached exchange mode.

I found the script

https://gallery.technet.microsoft.com/office/Determine-all-outlook-d43bd71f/file/143974/1/OutlookVersion.zip

Is there any way to add the laptop names.


Regards, Ajit

[Exchange Server 2013/ONLINE] - Send an email that was redirected to a mailbox on the server (Exchange server)

$
0
0

I have opened a centralized mailbox that collects all the emails that come to my organization (for analysis). This is done by a Transport Rule that i created which redirects all the email to this mailbox.

The problem is that when i tried to send it back to the original recipients with the EWS application it gives me this error: ErrorSendAsDenied - The user account which was used to submit this request does not have the right to send mail on behalf of the specified sending account., Cannot submit message.

This email was sent from outside of the organization so I guess i should grant the centrailzied mailbox SEND-AS permissions for the external email.

I have looked at the Add-ADPermission cmdlet here: https://technet.microsoft.com/en-us/library/bb124403%28v=exchg.160%29.aspx?f=255&MSPPError=-2147217396

And tried to grant the mailbox permissions to "NT AUTHORITY\ANONYMOUS LOGON" but it doesn't recognize it, How can grant the permissions?

Thanks!

Viewing all 7132 articles
Browse latest View live


Latest Images

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