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

Script to import GAL into Contact Folder

$
0
0

Hi,

I'm using this script to copy GAL contacts to a contact folder in some mailbox users.

https://gallery.technet.microsoft.com/scriptcenter/Importing-Global-Address-dc52a0ce

This script, search for a folder in contacts folder of user mailbox. If found, empty it, if not found, creates it. Once done whatever, begins to create contacts from GAL into the folder.

But I need not to empty the folder if exists, but check if the contact taken from the GAL exists in the folder. if not, create it; if exists, overwrite Name and Surname, telephone number and email address, leaving all other data without change.

I am not a Powershell EWS expert, and I don't know how to afford this. I have been searching a way to find and modify contacts, with no luck.

Could somebody help me?

Thanks


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?

How can I run an exchange management shell command within a scheduled task?

$
0
0

Hi,

I am trying to create a Windows Server 2008 R2 scheduled task that launches the exchange management shell application then runs a command. Within the "Action" of the scheduled task I am starting the below program:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

With the arguments:

-version 2.0 -noexit -command ". 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto" -Command "get-mailcontact -OrganizationalUnit "ABC.local/SP2013 Email Lists" -resultsize:unlimited -filter {ExchangeVersion -eq "0.0 (6.5.6500.0)"}  | Set-MailContact -EmailAddressPolicyEnabled:$true -RequireSenderAuthenticationEnabled:$False -Force"

But when the task runs I keep getting the below warning:

Task Scheduler did not launch task "\Microsoft\Windows\SharePoint\Upgrade Exchange Contact"  because instance "{42ef037d-e021-4ace-8a2c-84161175709e}"  of the same task is already running.

Followed by the below error:

Task Scheduler failed to start "\Microsoft\Windows\SharePoint\Upgrade Exchange Contact" task for user "ABC\Administrator". Additional Data: Error Value: 2147750687.

Any thoughts?

Thanks.

EWS Managed API started giving 401 unauthorized error

$
0
0

I have developed  office 365 outlook mail application which parses selected email message data (i.e. recipients details, subject, email body & attachments) using EWS API calls and saving these parsed information into our custom database. It is being working fine without any problems but EWS API calls started giving "401 unauthorized" exception since yesterday. I am able to login to my outlook web without any problems and i can access my mail app but i am frequently getting "401 unauthorized" exception when i try to parse email message details since yesterday.

Can anyone let me what could be the problem here?

I am using the below code snippet to parse email message information.

****************************************************************

ExchangeService service = new ExchangeService();
service.Credentials = new OAuthCredentials(CallBackAuthenticationToken);
service.Url = new Uri(request.EwsUrl);
service.CookieContainer = new CookieContainer();

PropertySet propSet = new PropertySet(BasePropertySet.IdOnly, ItemSchema.Subject);
Item item = Item.Bind(service, request.MessageId);

****************************************************************

Thanks & Regards,

Niranjan Rao Ch

EWS send mail error "The request failed. operation timeout"

$
0
0

If I add an attachment to more than 1.2M, the prompt operation is timed out; however, the use of outlook to send mail is not limited to the size of the attachment

thanks!

c# coding:

	static void Main(string[] args)
        {
            try
            {
                string username = args[0];
                string password = args[1];
                string domain = args[2];
                string frommail = args[3];
                string subject = args[4];
                string body = args[5];
                string[] tos = args[6].Split(';');
                string[] files = args[7].Split(';');

                ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);

                service.Credentials = new WebCredentials(username, password, domain);
                service.TraceEnabled = true;
                service.TraceFlags = TraceFlags.All;
                service.AutodiscoverUrl(frommail, RedirectionUrlValidationCallback);
                EmailMessage email = new EmailMessage(service);

                foreach (string t in tos)
                {
                    email.ToRecipients.Add(t);
                }
                email.Subject = subject;
                email.Body = new MessageBody(body);
                foreach (string s in files)
                {
                    email.Attachments.AddFileAttachment(s);
                }

                email.Send();
            }
            catch (Exception ex)
            {
                System.IO.File.AppendAllText(AppDomain.CurrentDomain.BaseDirectory + "\\Error.log", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ")+ex.Message+"\r\n");
            }
        }
	private static bool RedirectionUrlValidationCallback(string redirectionUrl)
        {
            bool result = false;
            Uri redirectionUri = new Uri(redirectionUrl);
            if (redirectionUri.Scheme == "https")
            {
                result = true;
            }
            return result;
        }


dog

modified occurrence is crossing or overlapping adjacent occurrence

$
0
0

Hi All,

I have created one daily recurrence appointment with no end date effective 6/23/2015(from past date) with periodicity is 1(recur every day). after creating the appointment, i have updated the recurrence with periodicity to 2(recur every two days). It is updated successfully. when i am going to update the single occurrence of a meeting it is throwing exception like'modified occurrence is crossing or overlapping adjacent occurrence".

For update i am using this query.

appointment.Update(ConflictResolutionMode.AutoResolve, SendInvitationsOrCancellationsMode.SendToNone);


Thanks

Naresh

makeEwsRequestAsync in mail app returning unathorized error 401.

$
0
0

HI ,

I am working on a mail app in which I am writing some data to custom fields in outlook, saving them on exchange server and displaying them to user. The app was working fine , but suddenly the call to method makeEwsRequestAsync() is returning an below error message and app is not working:

asyncResult.error.message :"The remote server returned an error: (401) Unauthorized." code: 9020

Please help if anyone knows about this error.

Thanks & Regards

Himanshu

Advanced Search API for Exchange not giving proper results

$
0
0

Hi ,

I have written a code to find out the number of mails recieved during a time period in a certain folder. I am using Application.AdvancedMethod search to get the output.

Below is the filter passed to the method along with folder path as scope which i am selecting using pickfolder method.

filter="urn:schemas:httpmail:datereceived> '" + startDate.Value.Date + "' AND urn:schemas:httpmail:datereceived < '" + endDate.Value.AddDays(1).Date+ "'";

I have folder structure from 2005 to 2015. For all the folders i have around 4000+ mails . The problem is that the method returns 0 results for all folders except 2014 and 2015. Even for 2014 and 2015 folders, it returns incorrect number. I am using Outlook 2013 with Exchange Server 2013. Please let me know if anyone knows the solution.<o:p></o:p>

Thanks.


How to set user's mailbox and folder permissions

$
0
0
I need to set access permissions for a user's mailbox and folders on exchange 2007. The powershell cmdlet Set-MailboxFolderPermission is available on exchange 2010 and 2013 and does the job. But that cmdlet is not available on exchange 2007. Does anyone know how to implement the equivalent functionality? There's the interface IExchangeManageStore that seems to work with outlook/MAPI but it requires a profile. It there anything better or easier server-side?

How to set exchange mailbox and folder permissions

$
0
0
I need to set access permissions for a user's mailbox and folders on exchange 2007. The powershell cmdlet Set-MailboxFolderPermission is available on exchange 2010 and 2013 and does the job. But that cmdlet is not available on exchange 2007. Does anyone know how to implement the equivalent functionality? There's the interface IExchangeManageStore that seems to work (client-side) but it requires a MAPI profile. It there anything better or easier server-side?

Difference between ICalUid and ConversationID

$
0
0

Hi All,

we are developing a sample calendar application using ews managed api. We were using IcalUid of an appointment to differentiate other appointments. I am facing one problem when updating specific occurrence of an recurrence series appointment, it is giving different ICalUid for that recurrence so we are unable to associate this changed occurrence with series.

Is there any other Id that is common for any appointment or series(including specific occurrences)?

Can we use ConversationId to differentiate appointments? Please suggest me.

Thanks

Naresh

Hybrid deployment mailbox synchronization question

$
0
0

Hello, I was told to post over here for some web.config file help in my new active directory account creation/ exchange mailboxes.  Here is my issue:

So, we have our faculty and staff on-premise and our students getting setup with office365 accounts.  Our students get created in active directory and then Azure Directory Sync syncs that user account to office365.  Then a license is applied to that user to get a mailbox on office365.  However, the user doesn't show up in both the on-premise mailbox list it only shows in the office365 mailboxes.  This means that when you are on the on-premise accounts webmail or outlook you cannot find that office365 user in the GAL.    However, if I run the command Enable-RemoteMailbox -Identity "user" -RemoteRoutingAddress "email" on the on-premise server the user then shows up as an office365 mailbox and then works in the GAL.  But, I cannot justify running this command on every single student account that gets created on office365 so there must be a better way.... Can anyone point me in the direction of what I may be doing wrong in my hybrid setup?   

I'm hoping I can add some something to my web.config file to add what I need for each user creation to automate this so I don't have to manually go in and do it.  Here is my web.config file with my domain name, username, and passwords edit out.

<!--Email Settings Start-->
    <!--Required Keys: [Username][ResetPassword]-->
    <add key="ResetPwdEmailSubject" value="Your domain Account Password."/>
    <add key="ResetPwdEmailBody" value="Please return to &lt;a href=http://domain.net&gt;http://domain.net&lt;/a&gt; and log in using the following password:&lt;br /&gt;&lt;br /&gt;Password: [ResetPassword]&lt;br /&gt;&lt;br /&gt;"/>
    <add key="GeneratePwdLength" value="7"/>
    <add key="EmailResetFailError" value="The email address provided does not match the alternate address listed for your account.  Please try password reset option #1."/>
    <!--Reset Password Email Settings End-->
    <add key="Domain" value="(domain Controller).net"/>
    <add key="ADStudentsPath" value="OU=fall10,OU=fall10,OU=Students,DC=,DC=net"/>
    <add key="ADEmployeesPath" value="OU=Employees,DC=,DC=net"/>
    <add key="ADGroupsPath" value="OU=Groups,DC=domain,DC=net"/>
    <!-- GD 20120606 <add key="ADProfilePath" value="\\student\student\profile\"/>-->
    <add key="ADProfilePath" value="\\fs-01\student\newprofile\"/>
    <!--User to perform functions-->
    <!--<add key="ADUser" value="Custom_User@test.net"/>
    <add key="ADPassword" value="pwd!"/>-->
    <add key="ADUser" value="aduser" />
    <add key="ADPassword" value="#pwd" />
    
    <!--<add key="ExchangeURI" value="https://mail01.domain.net/Powershell?serializationLevel=Full"/>
    <add key="ExchangeDomain" value="domain.net"/>
    <add key="ExchangeOU" value="domain.net/Students/fall10/fall10"/>
    <add key="ExchangeDatabase" value="Students"/>
    <add key="ExchangeUser" value="Custom_User@domain.net"/>
    <add key="ExchangePassword" value="#pwd"/>-->

    <!--Office 365 Settings Start-->
    <add key="365TargetDomain" value="manhattantech.onmicrosoft.com"/>
    <add key="365Domain" value="domain.net"/>
    <add key="365pSMTPproxy" value="domain.edu"/>
    <add key="365ssmtpproxy" value="domain.net"/>
    <add key="s365showInAddressBook1" value="CN=Default Global Address List,CN=All Global Address Lists,CN=Address Lists Container,CN=domain,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=domain,DC=net"/>
    <add key="s365showInAddressBook2" value="CN=All Users,CN=All Address Lists,CN=Address Lists Container,CN=domain,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=domain,DC=net"/>
 
    <!--Office 365 Settings End-->


Exchange, Lync FE and Lync Edge on a Single IP

$
0
0

I am trying to test a lab environment and would like to know is it possible to use a reverse proxy like IIS ARR to allow for a single external IP.

I have found that I can do it for lync without a reverse proxy so can I use it a reverse proxy for just the Exchange and Lync FE Server

http://blog.netnerds.net/2013/08/setup-a-fully-functional-lync-2013-lab-using-only-one-public-ip-address/

Ben

Exchange Management Console: initialization failed.

$
0
0

i spun up a new VM windows 2008 r8 server. I ran the exchange 2010 setup for the management tools only, no roles. When i finished the install and open the EMC, under Microsoft Exchange On-premises it states "initialization failed". My exchange environment has been running for more than 3 years now. All i'm trying to do is create a new server just for the Exchange Management Console to connect to my pre-existing Exchange 2010 environment. Any ideas on how this EMC can detect the Exchange enviro?

IIS and WWW publishing services have restarted. Registry value NodeStrutureSetting under HKEY_CURRENT_USER\SOFTWARE\Microsoft\ExchangeServer\v14\AdminToolshas been deleted but not success. This is not the first server setup like this but i was not the one to do it. Any ideas?

How to add contacts to All Contacts in directories

$
0
0

Hi,

     I are trying to add contacts and want to show it on all contacts folder in left navigation directory panel. I have used the following code.

try
            {
                ExchangeService Exchageser = new ExchangeService(ExchangeVersion.Exchange2010);
                Exchageser.Credentials = new WebCredentials("administrator", "test", "testtestdomian.in");
                //Exchageser.AutodiscoverUrl("cgvak@minasu.amsoftonline.net");
                Exchageser.Url = new Uri("https://test-exhsvr/ews/exchange.asmx");

                //#endregion
                //Folder rootfolder = Folder.Bind(Exchageser, "Directory");
                FolderView view = new FolderView(100);
                view.PropertySet = new PropertySet(BasePropertySet.IdOnly);
                view.PropertySet.Add(FolderSchema.DisplayName);
                view.Traversal = FolderTraversal.Deep;
                FindFoldersResults findFolderResults = Exchageser.FindFolders(WellKnownFolderName.Contacts, view);
                //find specific folder
                foreach (Folder f in findFolderResults)
                {
                    if (f.DisplayName == "GAL Contacts")
                    {
                        FolderId fID = f.Id;

                        Contact objCreatecontact = new Contact(Exchageser);
                        objCreatecontact.GivenName = firstname;
                        objCreatecontact.Surname = lastname;
                        objCreatecontact.EmailAddresses[EmailAddressKey.EmailAddress1] = new EmailAddress("Ra@testdomian.in");

                        objCreatecontact.Save(fID);
                    }
                }

            }
            catch(Exception ex)
            {
                return ex.ToString();
            }

But the above code helps me to add contact to the specific user. Kindly, let me know is there any possibilities to show the contacts in all contacts folder in left navigation.

Thanks..


Unable to connect Powershell Virtual directory using Powershell

$
0
0

Hi All,

I am trying to connect our Powershell Virtual Directory using powershell command as below. This is our requirement for one of new MDM solution we brought Airwatch. Our plan is to reject direct Activesync connection and it should come to Airwatch.

According to Air-watch this can be achieved by getting the Airwatch service account to connect to the Exchange powershell virtual directory, below is some test which i have performed using the service account. 

$cred = get-credentials

$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "http://Exchange2010.fqdn.com/powershell" -Credential $cred -Authentication Negotiate -AllowRedirection.

But unluckily i end up getting below error, tried all various option.

[Exchange2010.fqdn.com] Connecting to remote server failed with the following error message : The WinRM client cannot process the request. Un
encrypted traffic is currently disabled in the client configuration. Change the client configuration and try the request again. For more information,
 see the about_Remote_Troubleshooting Help topic.
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [], PSRemotingTransportException
    + FullyQualifiedErrorId : PSSessionOpenFailed



BR/Deepak

Issue with Loadgenconfig.xml generation

$
0
0

Hi,

   I am exploring Exchange Load Generator 2010 tool.

I am using command loadgemcmd /g to generate loadgenconfig.xml as per Microsoft documentation.

But this command is not generating any configuration and giving usage information like 

"Argument "GenConfig" is missing a value".

I want to modify this config file to proxy the MAPI for my test.

Any help is appreciated.

Thanks,

  Viswanath B


VISWANATH BUDDI

Hooking Outlook calendar events

$
0
0

Hi,

I need to hook (subscribe) to Outlook Calendar events (in my case it is a "resource" - room), in order to record all events in my ASP.NET application.

Is there a way to implement this?

Thank you in advance,

Shabtai

webservice call access denied error message

$
0
0

I am trying to call EWS service using jquery to send mail. I am getting access denied message. Please let me know if there are any suggestions.

   var soapMessage = '<?xml version="1.0" encoding="utf-8"?>'
   + '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'
   + 'xmlns:xsd="http://www.w3.org/2001/XMLSchema"'
   + '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>'
    + '<RequestServerVersion Version="Exchange2010_SP2" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" />'
   + '</soap:Header>'
   + '<soap:Body>'
    + '<m:CreateItem MessageDisposition="SendOnly">'
      + '<m:Items>'
       + ' <t:Message>'
       + '   <t:Subject>test</t:Subject>'
        + '  <t:Body BodyType="Text">test</t:Body>'
        + '  <t:ToRecipients>'
        + '    <t:Mailbox>'
        + '      <t:EmailAddress>myEmail@hotmail.com</t:EmailAddress>'
        + '    </t:Mailbox>'
        + '  </t:ToRecipients>'
        + '</t:Message>'
      + '</m:Items>'
     + '</m:CreateItem>'
     + '</soap:Body>'
   + '</soap:Envelope>';



        var ServiceUrl = 'https://serverName/EWS/Exchange.asmx';
        debugger;
                                                jQuery.support.cors = true;
                                                $.ajax({
                                                    url: ServiceUrl,
                                                type: "POST",
                                                dataType: "xml",
                                                data: soapMessage,
                                                contentType:"text/xml; charset=\"utf-8\"",
                                    success: processSuccess,
            error:processError
        });

        function processSuccess(data, status, req) {
            if (status == "success")
                alert("sucess");
        }

        function processError(data, status, req) {
            alert(data + " " + status);
        } 

How to add client certificate to windows server 2008R2 for Exchange 2010_SP3

$
0
0

Hi Team,

I have a problem with securing call to Exchange 2010_SP3. Currently we are usingEWS API 1.2 to make a call to Exchange server to get the calendar details. As of now we are connecting to Exchange using non secure protocolHTTP. We, need to make this call a secure one using HTTPS. We are making this Exchange call using EWS API from a java code. My doubt I have setup Exchange in one my VM and inIIS console I have changed the SSL settings to SSL required and HTTPS call is working. In that IIS console we have a 3 radio button for client certificates like Ignore, Accept and Require. If I select the client certificate as require my call is failing with an error saying connection cannot be established. Can you please let me know how can I create a client certificate and install in Exchange server 2010_SP3. Also can you please tell me how the exchange will be setup in production like whether the client certificates will be selected as Ignored or Accepted or Required........Also since I am making this Exchange call from java usingEWS API do I need to write any java code to validate client or Server certificates for making this Exchange call a secure one usingHTTPS protocol

Please see the Error Logs as below:-


microsoft.exchange.webservices.data.EWSHttpException: Connection not established
    at microsoft.exchange.webservices.data.HttpClientWebRequest.throwIfConnIsNull(Unknown Source)
    at microsoft.exchange.webservices.data.HttpClientWebRequest.getResponseCode(Unknown Source)
    at microsoft.exchange.webservices.data.EwsUtilities.formatHttpResponseHeaders(Unknown Source)
    at microsoft.exchange.webservices.data.ExchangeServiceBase.traceHttpResponseHeaders(Unknown Source)
    at microsoft.exchange.webservices.data.ExchangeServiceBase.processHttpResponseHeaders(Unknown Source)
    at microsoft.exchange.webservices.data.SimpleServiceRequestBase.internalExecute(Unknown Source)
    at microsoft.exchange.webservices.data.GetUserAvailabilityRequest.execute(Unknown Source)
    at microsoft.exchange.webservices.data.ExchangeService.getUserAvailability(Unknown Source)
    at com.taleo.em.service.integration.exchange.EWSTestSuite.checkUserAvailability(EWSTestSuite.java:123)
    at com.taleo.em.service.integration.exchange.EWSTestSuite.main(EWSTestSuite.java:87)

Thanks,

Anuj Jain

Viewing all 7132 articles
Browse latest View live


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