EWS Connect with SharePoint, Performance

Standard

For my experience using EWS with SharePoint I want to share some useful information.

When you connect to Exchange Online with SharePoint a big performance improvement is to write a console application in order to get your Service URL and pass it directly. But to do this SharePoint ask you for a certificate, the workaround is to pass a Dummy X509 CER, code bellow, comment if it help.

// <summary>
/// Gets the binding.
/// </summary>
/// <returns></returns>
public static ExchangeService GetBinding()

{
   
try
   
{
       
//Create Service
        ExchangeService service = new

           
ExchangeService(ExchangeVersion.Exchange2010_SP1);
       
//Assign Credentials
        service.Credentials = new

           
WebCredentials("admin@contoso.com", "password");
       
ServicePointManager.ServerCertificateValidationCallback +=
           
RemoteCertificateValidationHandler;
       
//Change this line by your EndPoint Url
        service.Url = new Uri("https://SERVER.outlook.com/EWS/Exchange.asmx");

       
return service;
   
}
   
catch (AutodiscoverRemoteException ex)
   
{
       
Console.WriteLine("Exception thrown: " + ex.Error.Message);
       
return null;
   
}
}

private static bool RemoteCertificateValidationHandler
   
(object sender, X509Certificate certificate,
   
X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
   
return true; //ignore the checks and go ahead
}

Reply and Forward with full information

Standard

When you use message.Reply() or message.Forward() you are unable to add extra information, like recipients, attachments etc.., in order to workaround you must use the CraeteReply() and CreateForward() methods.

You will need the GetBind() method in order to use this code

REPLY

/// Replies the message. 
/// <param name="messId">The mess id.</param>
/// <param name="body">The body.</param>
/// <param name="replyAll">if set to <c>true</c> [reply all].</param>
/// <returns></returns>
private bool ReplyMessageCreate(string messId, string body, bool replyAll)

{
   
ExchangeService service = GetBinding();

    try
   
{
       
Item mess = Item.Bind(service, messId);
       
EmailMessage message = mess as EmailMessage;
       
if (message != null)
       
{
           
ResponseMessage reply = message.CreateReply(replyAll);
           
reply.BodyPrefix = body;

            EmailMessage replyMessage = reply.Save(WellKnownFolderName.Drafts);
           
foreach (string item in YourRecipients)
           
{
               
replyMessage.ToRecipients.Add(item);
           
}

            foreach (string item in YourRecipients)
           
{
               
replyMessage.CcRecipients.Add(item);
           
}

            foreach (string item in YourRecipients)
           
{
               
replyMessage.BccRecipients.Add(item);
           
}

            replyMessage.Attachments.AddFileAttachment(c:\att.txt);
        
           
replyMessage.Update(ConflictResolutionMode.AlwaysOverwrite);
           
replyMessage.SendAndSaveCopy();
       
}

        return true;
   
}

    catch (Exception)
   
{
       
return false;
   
}
}

FORWARD

// <summary>
/// Replies the message. 
/// <param name="messId">The mess id.</param>
/// <param name="body">The body.</param>        
/// <returns></returns>
private bool ForwardMessageCreate(string messId, string body)

{
   
ExchangeService service = Bind.GetBinding(Bind._ImpersonateUser);

    try
   
{
       
Item mess = Item.Bind(service, messId);
       
EmailMessage message = mess as EmailMessage;
       
if (message != null)
       
{
           
ResponseMessage forward = message.CreateForward();
           
forward.BodyPrefix = body;

            EmailMessage forwardMessage = forward.Save(WellKnownFolderName.Drafts);
           
foreach (string item in YourRecipients)
           
{
               
forwardMessage.ToRecipients.Add(item);
           
}

            foreach (string item in YourRecipients)
           
{
               
forwardMessage.CcRecipients.Add(item);
           
}

            foreach (string item in YourRecipients)
           
{
               
forwardMessage.BccRecipients.Add(item);
           
}

            forwardMessage.Attachments.AddFileAttachment(c:\att.txt);

            forwardMessage.Update(ConflictResolutionMode.AlwaysOverwrite);
           
forwardMessage.SendAndSaveCopy();
       
}

        return true;
   
}

    catch (Exception)
   
{

        return false;
   
}
}

Installing and Deploying Office 365 (Part II of II)

Standard

This procedures where tested in a VM with

  • 1 Intel® Core™ 2 T7250 2.00 GHz
  • 14 GB HDD
  • 1GB RAM
  • Windows XP SP3
  • Windows Explorer 8 for Windows XP
  • No Updates Applied

Office 365 Plan

  • Office 365 Plan E3

SET UP AND CONFUGURE OFFICE DESKTOP APPS

See PART I

image_thumb[25]

Click SETUP and Run EXE File

You will need FRAMEWORK 2.0 in order to Install, but the installation packaged do this for you

image_thumb[31]

Run the ClickOne Packaged from Server

image

If you already configured this step but want to configure more options, signing appear, LOGIN

image

You will be prompted for

image

Downloading…

image

image

image

Open Outlook

image

NOW FOLLOW MY LINK AT HERE

Signing

image

image

See PART I

RELATED

Office 365 FAQ’S

Installing and Deploying Office 365 (Part I of II)

Standard

This procedures where tested in a VM with

  • 1 Intel® Core™ 2 T7250 2.00 GHz
  • 14 GB HDD
  • 1GB RAM
  • Windows XP SP3
  • Windows Explorer 8 for Windows XP
  • No Updates Applied

Office 365 Plan

  • Office 365 Plan E3

I’m using Windows XP only for testing proposes so you can assume that all future versions of Windows will be supported also

    First of all you will need to access your Portal Administration and click HOME and SETUP NOW
    INSTALL OFFICE PROFESSIONAL PLUS 2010

image

Installing Office Professional Plus

Office 365 will update Office for Download always to the LAST VERSION, you cannot download a previous version

Choose your LANGUAGE and PLATFORM (32 or 64 Bits)

image

Your are prompted to Download, so Save in your Hard Drive

Run your SETUP and install like a Normal Office Installation

What is included?

image

After install you will be Prompted for give your Office 365 Credentials

image

image

image

image

For Multilanguage Deployments, you can adopt the same deployment technics as a Normal Office Deployment

Deploy Multilanguage Packs for Microsoft Office 2010

INSTALLING LYNC 2010

image

Download and RUN the EXE File

You must understand that:

If you are an administrator for Microsoft Office 365 for enterprises, ensure that your Office 365 subscription includes licenses for Microsoft Lync Online. If your subscription does not, you must purchase licenses for Microsoft Lync 2010 in Office 365. For details, see Manage licenses.

See PART II

RELATED

Office 365 FAQ’S

set-CASMailbox parameters in detail

Standard

set-CASMailbox -Identity <MailboxIdParameter>

SAMPLES

Set-CASMailbox -Identity adam@contoso.com -OWAEnabled:$true -POPEnabled:$true

This example enables Exchange ActiveSync logging, blocks Outlook Anywhere, and specifies the Exchange ActiveSync mailbox policy for the user adam@contoso.com.

  • [-ActiveSyncAllowedDeviceIDs <MultiValuedProperty>]
  • [-ActiveSyncBlockedDeviceIDs <MultiValuedProperty>]
  • [-ActiveSyncDebugLogging <$true | $false>]
  • [-ActiveSyncEnabled <$true | $false>]
  • [-ActiveSyncMailboxPolicy <MailboxPolicyIdParameter>]
  • [-Confirm [<SwitchParameter>]] [-DisplayName <String>]
  • [-DomainController <Fqdn>] [-ECPEnabled <$true | $false>]
  • [-EmailAddresses <ProxyAddressCollection>]
  • [-EmwsEnabled <$true | $false>]
  • [-EwsAllowEntourage <$true | $false>]
  • [-EwsAllowList <MultiValuedProperty>]
  • [-EwsAllowMacOutlook <$true | $false>]
  • [-EwsAllowOutlook <$true | $false>]
  • [-EwsApplicationAccessPolicy <EnforceAllowList | EnforceBlockList>]
  • [-EwsBlockList <MultiValuedProperty>] [-EwsEnabled <$true | $false>]
  • [-HasActiveSyncDevicePartnership <$true | $false>]
  • [-IgnoreDefaultScope <SwitchParameter>]
  • [-ImapEnabled <$true | $false>]
  • [-ImapEnableExactRFC822Size <$true | $false>]
  • [-ImapMessagesRetrievalMimeFormat <TextOnly | HtmlOnly | HtmlAndTextAlternative | TextEnrichedOnly | TextEnrichedAndTextAlternative | BestBodyFormat | Tnef>]
  • [-ImapSuppressReadReceipt <$true | $false>] [-ImapUseProtocolDefaults <$true | $false>]
  • [-MAPIBlockOutlookNonCachedMode <$true | $false>]
  • [-MAPIBlockOutlookRpcHttp <$true | $false>]
  • [-MAPIBlockOutlookVersions <String>]
  • [-MAPIEnabled <$true | $false>] [-Name <String>]
  • [-OWAEnabled <$true | $false>]
  • [-OwaMailboxPolicy <MailboxPolicyIdParameter>]
  • [-PopEnabled <$true | $false>] [-PopEnableExactRFC822Size <$true | $false>]
  • [-PopMessagesRetrievalMimeFormat <TextOnly | HtmlOnly | HtmlAndTextAlternative | TextEnrichedOnly | TextEnrichedAndTextAlternative | BestBodyFormat | Tnef>]
  • [-PopSuppressReadReceipt <$true | $false>] [-PopUseProtocolDefaults <$true | $false>]
  • [-PrimarySmtpAddress <SmtpAddress>] [-SamAccountName <String>]
  • [-ShowGalAsDefaultView <$true | $false>]
  • [-WhatIf [<SwitchParameter>]

Disable EWS Access for a particular Mailbox

Standard

From the Michael Mainer – MSFT Blog on MSDN I found this useful information

Exchange Web Services (EWS) is a robust API that exposes many Exchange client access features. Many popular clients use this API on many different platforms. What if you want to limit client access via EWS, however? You do have an option. In Exchange 2010, you can use the Set-CASMailbox command to modify EWS access.

Note: The Set-CASMailbox command in Exchange 2007 does not provide options for limiting EWS access.

The following options that the Set-CASMailbox command exposes enable you to change the settings on a per-user basis:

  • Turn EWS on/off
  • Turn EWS on/off for Outlook, Mac Outlook, and Entourage
  • Turn EWS on/off using allow/block lists for user agent filtering
    These options make use of the user agent header to filter access. While useful in many scenarios, user agent filtering has one inherent disadvantage: User agent strings can easily be written to represent agents on an allowed list, including Outlook, Mac Outlook, and Entourage. Of equal importance is the fact that specific EWS features can’t be blocked. EWS feature access is not segmented to allow access to particular EWS operations — it’s all or nothing. Turning off EWS will affect clients that use the OOF settings, availability, mail tips, and so on. It is important to take this into consideration when planning the client-server interaction part of your system architecture.