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

Raed the latest message from an email thread

$
0
0

Hi,

Can I extract the latest message from an email thread in Exchange Transport Agent in Exchange 2013? For example. if someone replied to my email, I want to get the only text the other person added when he/she replied to my email (when intercept in Exchange transport agent).

Help will be very much appreciated.

Thanks.




Send Welcome Email to New User using the Scripting Agent

$
0
0

Hi

I require some assistance please.  I have found a number of scripts online to send a Welcome Email to new users whereby they make use of the ScriptingAgent.xml file.

I like the way the scripts have been configured and have mashed up one or two scripts together for my desired result however when testing in my lab (Exchange 2013) I have found tow problems.

The problems are:

1. When creating a new user and mailbox (New-Mailbox) via the ECP the script throws out an error which I will post later in this post. The mailbox is created fine but it does not send out a welcome email.  When a user is created in ADUC and then a mailbox is created (Enable-Mailbox) the welcome email is sent out correctly.

2. In the script i have a section to check for NewUser00 in the HTML file and replace that with the Users Name and Surname, however this does not work correctly, I just come up blank:

The Script:

<?xml version="1.0" encoding="utf-8" ?><Configuration version="1.0"><Feature Name="WelcomeEmail" Cmdlets="New-Mailbox,Enable-Mailbox"><ApiCall Name="OnComplete">

if($succeeded) {
    # Waiting for synchronization after mailbox has been created.
    Set-ADServerSettings -ViewEntireForest $true
    Start-Sleep -s 10
    # New-Mailbox triggered. Taking SamAccountName parameter.
        if ($provisioningHandler.UserSpecifiedParameters.Contains("SamAccountName") -eq $true) {
	$UsrSamAccountName = $provisioningHandler.UserSpecifiedParameters["SamAccountName"]
	$USRdfirst = $provisioningHandler.UserSpecifiedParameters["FirstName"]
	$USRdlast = $provisioningHandler.UserSpecifiedParameters["LastName"]
	$UsrAlias = (Get-Mailbox -Filter {SamAccountName -eq $UsrSamAccountName}).Alias.ToString()
	$USRdname = $USRdfirst + " " + $USRdlast
        }
    # Enable-Mailbox triggered. Taking Identity parameter, this is the only one avalaible in this case.
    if ($provisioningHandler.UserSpecifiedParameters.Contains("Identity") -eq $true) {
    $UsrIdentity = $provisioningHandler.UserSpecifiedParameters["Identity"].ToString()
    $USRdfirst=$provisioningHandler.UserSpecifiedParameters["FirstName"]
    $USRdlast=$provisioningHandler.UserSpecifiedParameters["LastName"]
    $UsrAlias = (Get-Mailbox -Identity $UsrIdentity).Alias.ToString()
    $USRdname= $USRdfirst + " " + $USRdlast
    }

    # Defining variables.
        $UsrAddr = (Get-Mailbox -Filter {Alias -eq $UsrAlias}).PrimarySmtpAddress.ToString()
        $UsrOU = (Get-Mailbox -Filter {Alias -eq $UsrAlias}).OrganizationalUnit

            # Sending email notification to the user in specific OU.
        if ($UsrOU -match "Contoso.com") {

        ####################
        #      HR          #
        ####################
        $fromHR="HR@contoso.com"
        $SubjectHR="'Welcome to Contoso'"
        $BodyHR = [string] (get-content ("c:\welcome\WelcomeMSG.htm"))
	$BodyHR = $BodyHR -replace "NewUser00",$USRdname
        $fileHR = "c:\welcome\WelcomeMSG.htm"
        $smtp="192.168.x.x"
        Send-MailMessage -From $fromHR -To $UsrAddr -Subject  $SubjectHR -Body $BodyHR -BodyAsHtml -Encoding ([System.Text.Encoding]::UTF8) -SmtpServer $Smtp
        ####################
 }
 # Clearing variables. Each one in its own line in order to prevent error messages from being shown on EMC.
 if ($UsrAlias) { Remove-Variable UsrAlias }
 if ($UsrAddr) { Remove-Variable UsrAddr }
 if ($UsrOU) { Remove-Variable UsrOU }
 if ($UsrMsg) { Remove-Variable UsrMsg }
 if ($UsrIdentity) { Remove-Variable UsrIdentity }
 if ($UsrSamAccountName) { Remove-Variable UsrSamAccountName }
}</ApiCall></Feature></Configuration>

The Error for issue 1:

The cmdlet extension agent with the index 5 has thrown an exception in OnComplete().
The exception is: Microsoft.Exchange.Provisioning.ProvisioningException: ScriptingAgent:
Exception thrown while invoking scriptlet for OnComplete API: You cannot call a method on a
null-valued expression.. ---> System.Management.Automation.RuntimeException:
You cannot call a method on a null-valued expression. at CallSite.Target(Closure , CallSite , Object ) at
System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0) at
System.Management.Automation.Interpreter.DynamicInstruction`2.Run(InterpretedFrame frame) at
System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
 --- End of inner exception stack trace --- at Microsoft.Exchange.ProvisioningAgent.ScriptingAgentHandler.OnComplete(Boolean succeeded, Exception e)
 at Microsoft.Exchange.Provisioning.ProvisioningLayer.OnCompleteImpl(Task task, Boolean succeeded, Exception exception)


Any assistance in resolving these two issues will be really appreciated


[EWS] [Java] UTC times in meeting invites, cannot set TimeZoneDefinition

$
0
0

I'm creating appointments with attendees (aka meetings) and sending invitations.  However, the times listed in the text of the invitation are UTC and I can't figure out how to change it or suppress it:  

When: Wednesday, July 08, 2015 3:00 PM-3:30 PM. UTC

Where: 240 BC

*~*~*~*~*~*~*~*~*~*

I've tried setting the time zone at the service level, but it doesn't help.

new ExchangeService(ExchangeVersion.Exchange2010, TimeZone.getTimeZone("America/Chicago"))

Then I tried setting the TimeZoneDefinition for the appointment with appointment.setStartTimeZone(timeZoneDefinition), but every single definition returns a "The time zone definition is invalid or unsupportederror.  (I called .validate() on every definition available on our server.)

I am forced to use Java for this project, so TimeZoneInfo is sadly unavailable to me.  I am sending dates with the appropriate UTC offset when creating the appointments.

Does anyone have any ideas on how I can get this fixed?  It's a serious issue for us since the times in the text of the invitation are incorrect.  If you know how to suppress that extra text in the invite, that would work too.  


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


EWS managed api read emails for process mailbox with service account

$
0
0

Hi,

I have setup a process mailbox account on exchange and added service account with editfor permissions.

When I try to call service.FindItems using C# managed api I am getting the following error;

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.

Any ideas?

I am creating the exchange service instance with the NetworkCredential of the service account.

Am I missing something obvious?

Thanks

EWS Managed API: "One or more subscriptions in the request reside on another Client Access server. GetStreamingEvents won't proxy in the event of a batch request."

$
0
0

Using streaming subscriptions in Exchange Online cloud. I group subscriptions into shared connections by groupinfo from Autodiscover. To create a new group I start with the service impersonating Anchor user. Then I set anchor header and prefer affinity header. I retain the service instance for creating the connection and all subsequent subscriptions in this group because it has the backend override response cookie.

Periodically I get an error on a subscription:

Unable to retrieve events for this subscription.  The subscription must be recreated.

We have code written to handle this. It immediately looks up the subscriber's group info in autodiscover and creates a new subscription by the same rules above.  I have verified the groupinfo coming back is a different value than the first subscription. I do not have the exact location of the failure, but I believe I have it isolated to this code:

subscriptionSet.Subscription = Service.SubscribeToStreamingNotifications(folders, EventType.Created);
Connection = new StreamingSubscriptionConnection(Service, 30);
 Connection.OnDisconnect += new StreamingSubscriptionConnection.SubscriptionErrorDelegate(Connection_OnDisconnect);
 Connection.OnNotificationEvent += new StreamingSubscriptionConnection.NotificationEventDelegate(Connection_OnNotificationEvent);
 Connection.OnSubscriptionError += new StreamingSubscriptionConnection.SubscriptionErrorDelegate(Connection_OnSubscriptionError);
Connection.AddSubscription(subscriptionSet.Subscription);

Somewhere in that code the following exception is being thrown:

One or more subscriptions in the request reside on another Client Access server. GetStreamingEvents won't proxy in the event of a batch request.

When I restart the same subscriber manually with the same groupinfo, it works minutes later. But during the moments after the error, when I go to create the subscription it fails.  I do not know which line is throwing this exception, but I can't reproduce it. I will have more instrumentation the next time it happens, but for now this is all I have.

What I'm wondering is if these events in the cloud -- specifically, the ones that cause me to have to create a new subscription -- I'm wondering if maybe some replication must occur to establish the resource on the new CAS/or mailbox server, and if by reconnecting immediately I am not allowing this replication to get everywhere it needs to be.

Other than that I am out of ideas, because I know the groupinfo I'm using will be good in a few minutes, so I doubt it's that.

And since we're here, does anyone know which of those statements might be throwing this error? Maybe I could just put a catch to suppress this particular error and move on.

Thanks in advance.

Exchange 2010 application on Visual Studio 2012 (.NET 4.0): Cannot load Exchange powershell snap-in: The type initializer for 'Microsoft.Exchange.Data.*' threw an exception

$
0
0

Hi

I have recently upgraded my application from .NET framework 2.0 to 4.0. I am facing a strange problem after upgrade. I am unable to load Microsoft Exchange Assemblies. 

 rc = RunspaceConfiguration.Create();
                warning = null;
                if (Version == "2010")
                    info = rc.AddPSSnapIn("Microsoft.Exchange.Management.PowerShell.E2010", out warning);

I am unable to understand the cause of the problem. But with reference to the this article, I have concluded that this is a bug. Please suggest the soultion. 
Thanks in advance


Rizwan Ahmed. Software Engineer - Microsoft Lync | Exchange | SharePoint | Blackberry Enterprise Server | .NET

How to get information of contact from contact list by mail app

$
0
0

Hello everyone,

I am building a mail app for outlook

account is office365

i got inputted email from field to,cc,bcc

if inputted email is exist in exchange online

i want to get more information as department, job tittle of this email

anyone know how can do that

can give me some guide?

Thanks in advance,

QP


C# and Powershell

$
0
0

I have seen a lot of posts on running Powershell in C# and have code that is working great when run under my account. What I'm wanting to do though is put my code in a monitoring service and have it still work. The monitor service run as Local System then the individual monitors run with specified crendials which allows us to use the same monitor service to monitor across domains.

 

Does anyone here know how I could run Powershell in C# with alternate credentials?

 

Thank you,

Dave 

Search appointments by required or optional attendees

$
0
0

Hi there

I need to search appointments by required or optional attendees using EWS. I've tried with a search filter collection and a query string but none of these options worked.

Search Filter Collection

var attendeeFilter = new SearchFilter.SearchFilterCollection(LogicalOperator.Or)
            {
                new SearchFilter.ContainsSubstring(AppointmentSchema.RequiredAttendees, mailAddress),
                new SearchFilter.ContainsSubstring(AppointmentSchema.OptionalAttendees, mailAddress),
            };

FindItemsResults<Item> results = ews.FindItems(WellKnownFolderName.Calendar, attendeeFilter, view);

Query String

string queryString = string.Format("(RequiredAttendees:{0} OR OptionalAttendees:{0})", mailAddress);

FindItemsResults<Item> results = ews.FindItems(WellKnownFolderName.Calendar, queryString, view);

Does anyone know the magic trick to achieve this?

Write permission summary to delegates missing in Exchange Web Services Managed API?

$
0
0

Hello,

I found all permissions for a configured delegate in the 'DelegateUser.Permissions' class but I can not find the option 'Write summary to delegate'. Do you know where can I find it in the Exchange Web Services Managed API? Thank you.

Sorry I have only a screenshot from a german Outlook.

How to specify custom property set for GetPersona operation

$
0
0

I'm making raw GetPersona SOAP requests to Exchange server (office365). As a response I get Persona object with all additional properties. How can I modify my request to get only some properties (e.g. job title, department, country)?

Here is how my request looks like:

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"><soap:Header><t:RequestServerVersion Version="Exchange2013"/></soap:Header><soap:Body xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"><GetPersona><PersonaId Id="AAQkADEzAQAKtOtR/l4MlLqHWORfhSYKU="/></GetPersona></soap:Body></soap:Envelope>


Send to mass email to users in Exchange

$
0
0

Hi All, 

I need to email around 40 K users across different geographical locations in Exchange. 
I have PowerShell script to send users. 

But I know what will impact on Exchange's server performance. 

Q) What is the maximum number of email in Exchange server 2010/2013. 

Q) How can I send emails to users without affecting server performance.  

 


Sandy

How to get sent and received email list of a 'Universal Distribution group' id through EWS?

$
0
0

Hi Support,

I am using EWS to query some reports from exchange server 2010 and able to get results for Users using impersonation.

When I am trying same with Distro Groups it gives error i.e 'The SMTP address has no mailbox associated with it.'

Is there any way to access emails of Distro Groups?

Thanks & Regards

Nitin Kadam



How to move default folder location of SMTP server to shared folder.

$
0
0
SMTP is installed in two of the WFEs.  Default location of SMTP folders is c:\inetpub\mailroot\. To achieve high availability, we are planning  to implement network shared folder as the default folders for both the SMTP in WFEs. Is it possible to implement? Please advise.

how can we know if a conference room has resources like projector , whiteboard etc using c#

$
0
0

Hi

We have a requirement to search a conference room having a projector or whiteboard.

can we achieve this using c#. which libraries do i need to use.

Thanks,

Sravan kumar

Can we use ADAL token to book a meeting room instead of passing password, using C# or is there any way to book a meeting room with out asking user to enter password

$
0
0

Hi

we have a requirement to book a meeting room, but for that we need to give password. so we wondering if there is any way like passing OAuth token like thing to book a room.

Thanks adv,

--Sravan kumar

EWS Managed Api - Attachment URL

$
0
0

Hi

I am using EWS Managed Api 2.2 and Exchange Server 2010_SP2. I am developing something to get attachment of email. I am wondering if I can get the url of any attachment in email to access from anywhere.

Thanks

Cannot fetch additional properties when using FindPeople

$
0
0

I'm using raw SOAP request to get a list of people from GAL in Office365, By default, it returns only basic information about each Persona, when I try to add additional properties, like persona:PhoneNumber or change BaseShape to AllProperties, it returns an error "Invalid shape specification"

How can I get all properties for each Persona using this call? 

<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
               xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"><soap:Header><t:RequestServerVersion Version="Exchange2013" /></soap:Header><soap:Body ><m:FindPeople><m:PersonaShape><t:BaseShape>IdOnly</t:BaseShape><t:AdditionalProperties><t:FieldURI FieldURI="persona:DisplayName"/><t:FieldURI FieldURI="persona:Title"/><t:FieldURI FieldURI="persona:EmailAddress"/><t:FieldURI FieldURI="persona:PhoneNumber"/></t:AdditionalProperties></m:PersonaShape>         <m:IndexedPageItemView BasePoint="Beginning" MaxEntriesReturned="100000" Offset="0"/><m:ParentFolderId><t:AddressListId Id="xxxxxxx-xxxx-xxxx-xxxx-xxxxxx"/></m:ParentFolderId></m:FindPeople></soap:Body></soap:Envelope>

Delete appointment restriction using EWS.

$
0
0

We are creating appointment in Outlook 2013 using EWS API. We want to create appointment which will not be delete by user. Only service can delete these appointment. how we can enable this feature for appointment.(*Appointment should not be delete by user*)

Currently, We are using Lotus notes and We can make appointment read only in notes for users.But API can delete these appointment.

Code:-

ExchangeService exchangeService = objExchangeservice_Conn.fnExchangeService_Conn();
            //Create an appointment
            try
            {
                  Appointment appointment = new Appointment(exchangeService);

                //object to create an appointment.
                appointment.Subject = "Test Meeting  ";
                appointment.Body = "This is test for a appointment";
                appointment.Start = DateTime.Now.AddDays(1);
                appointment.End = appointment.Start.AddHours(1);
                appointment.Location = "test";

                appointment.ReminderDueBy = DateTime.Now;
                appointment.RequiredAttendees.Add("");
 appointment.Save(SendInvitationsMode.SendToNone);
Item item = Item.Bind(exchangeService, appointment.Id, new PropertySet(ItemSchema.Subject));



Viewing all 7132 articles
Browse latest View live


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