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

Persisting email contents in DB in Transport Agent

$
0
0

HI All,

I need to write a transport agent to store email in the database.I created a class library project.Added ADO.net data model. When i get the instance of data model. It throws error:

"The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid."

The same thing works fine when i create a console appplication.I have checked app.config file, there exist my connection string.Don't know why it is throwing error.

Any Idea?


CAS 2010 edition

$
0
0

Hi,

I would like to know the limitness in Exchange 2010 std for CAS role. Is it good to go with Std edition for Exchange 2010 CAS/HT role?

Thanks

Rajneesh


Rajneesh Kumar MCITP - SA, MCSE, CNA

EWS Api problem connecting Inbox

$
0
0

Hi together

Could someone help me please in this matter.

I am trying to connect to a Inbox using ews api and getting always following error message.

Exception calling "Bind" with "2" argument(s): "The request failed. The underlying connection was closed: An unexpected error occurred on a send."

At C:\Scripts\Entwicklung\SwisEMS\GetInbox2.ps1:18 char:1

+ $Inbox = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($service,$folderid)

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException

    + FullyQualifiedErrorId : ServiceRequestException

My Script connecting to an inbox

Function ConnectExchangeService($ExchangeServer)
{
[Reflection.Assembly]::LoadFile("C:\Program Files (x86)\Microsoft\Exchange\Web Services\2.1\Microsoft.Exchange.WebServices.dll") | Out-Null
$service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2010_SP2)
$service.Url = new-object Uri("https://$ExchangeServer/ews/exchange.asmx")
return $service
}
$ExchangeServer = "server.test.com"
$service = ConnectExchangeService $ExchangeServer
$service.Credentials = New-Object System.Net.NetworkCredential('username@domainname','Password')
$MailboxName = "test@test.com"
$service
#Bind to Inbox 
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {return $true}
$folderid= new-object Microsoft.Exchange.WebServices.Data.FolderId([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Inbox,$MailboxName)     
$Inbox = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($service,$folderid)    
   $Inbox

Do you have any Suggestion what the Problem is...

Thanks in advance for your help


Exchange Server/CCR/Primary To Secondry Moved Failed

$
0
0

Operation System : Windows Server 2003 Ent 64bit

Exchange Server Version : Exchange Server 2007 SP3

We had TWO Mail Boxes Server (PHYSICAL MACHINE) with CCR, Few Days back one of our Secondary Mail Box Server Machine Gone Faulty and we ready another Mailbox Server but this time on HYPER V VM , Machine works fine as Secondary.

But

When we try to move group for new machine as a "Primary Mail Box" server it was stuck on MS Cluster End and unable to transfer and got this error

The crypto checkpoint for cluster resource 'Exchange Information Store Instance (khi-cms-01)' could not be restored to the container name 'C44FBC30-1445-11d3-8CAA-00104B9C5823'. The resource may not function correctly.

We have Identified that this error causes due to Forefront installation at Primary Server so we removed Forefront but Issue Remains Same but errors are changed this time.

Here are Error Events on Primary Mail Box Server:

Event Id : 4

"The kerberos client received a KRB_AP_ERR_MODIFIED error from the server host/khi-mbx-01.dib.ae.  The target name used was khi-cms-01. This indicates that the password used to encrypt the kerberos service ticket is different than that on the target server. Commonly, this is due to identically named  machine accounts in the target realm (DIB.AE), and the client realm.   Please contact your system administrator."

Event id :1069

Cluster resource 'Exchange Information Store Instance (khi-cms-01)' in Resource Group 'khi-cms-01' failed.

Event id : 7034

The Microsoft Exchange Information Store service terminated unexpectedly.  It has done this 8 time(s).

Event id : 1009

Cluster service could not join an existing server cluster and could not form a new server cluster. Cluster service has terminated.

Event id 40960

The Security System detected an authentication error for the server cifs/KHI-AD-02.DIB.AE.  The failure code from authentication protocol Kerberos was "The time at the Primary Domain Controller is different than the time at the Backup Domain Controller or member server by too large an amount. (0xc0000133)".

Here are Events on Secondry Mail Box Server :

Event id :7034

The Microsoft Exchange Information Store service terminated unexpectedly.  It has done this 8 time(s).

Event id : 1069

Cluster resource 'Exchange Information Store Instance (khi-cms-01)' in Resource Group 'khi-cms-01' failed.

Event id : 4

The kerberos client received a KRB_AP_ERR_MODIFIED error from the server host/khi-mbx-01.dib.ae.  The target name used was khi-cms-01. This indicates that the password used to encrypt the kerberos service ticket is different than that on the target server. Commonly, this is due to identically named  machine accounts in the target realm (DIB.AE), and the client realm.   Please contact your system administrator.

Event id : 29

The time provider NtpClient is configured to acquire time from one or more time sources, however none of the sources are currently accessible.  No attempt to contact a source will be made for 1 minutes. NtpClient has no source of accurate time.

Pls Help ............................

Equipment mailbox not in GAL, sort of!

$
0
0

I am getting bald from ripping out my hair on this one.


I have an equipment mailbox, that was created 24 hours ago, but it is still not in the global address list... maybe!

See, when i look in the list, it is not there. When i search the list, it is not there. When i do an advanced search fro the display name, it is not discovered.

When i do an advanced search for the first name, it is discovered.

I have several room mailboxes, and have done a comparison. There are no difference what so ever in their setup, either in Exchange nor in AD. And yes, the equipment mailbox does have a display name, even though GAL does not discover it in a search.

Any ideas?

How to cut a specific name up to the @ character

$
0
0

Hello guys,

I would like to write a script that reads all active emails and then cuts it at the @ character and exports this in a Excel then create a new alias with the string before the at and a specific domain at the end.

I hope that you can help me!

Best regards

Matthias

UnAuthorized at service.FindFolders?

$
0
0

Hi :

I am using EWS for reading folders & mails in exchange server 2007, 2010.

I am getting error as 401 UnAuthorized on service.FindFolders.

I am providing url as https://server name/ews/exchange.asmx.

Please suggest.

Thanks,

Bhushan

Global Object Id - how to get in EWS?

$
0
0

I am using EWS Managed API 2.1 and Exchange 2010. What will I have to request from Exchange server, and how do I convert it to string, to put it into AvailabilityOptions.GlobalObjectId?

What I want to achieve and what I have done so far:
To decide whether an appointment item in the Exchange database has a conflicting entry or not, I do a request on ExchangeService.GetUserAvailability(List<AttendeeInfo>, TimeWindow, AvailabilityData, AvailabilityOptions), with  AvailabilityOptions.GlobalObjectId set to Appointment.Id.UniqueId.
This does not work - the Appointment is still listed in the returned results - presumably because UniqueId is different from GlobalObjectId.

I did not find any specifications as to what a GlobalObjectId is, how it looks like, how to get it, and where else except for this single case it is used in any way in EWS (while it is used in Mapi all over the place). All I found was an ominous "ExtendedPropertyDefinition", which translated to 
ExtendedPropertyDefinition globalObjectId = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Meeting, 35, MapiPropertyType.Binary)
and should come as byte[], not string, while AvailabilityOptions.GlobalObjectId requires a string.

I would like to propose that since a certain property has to be put there, one should find either a link to that property, a description how to get it or a link to the description how to get it, in your documentation at http://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.availabilityoptions.globalobjectid(v=exchg.80).aspx


[E2010][PS][VB.Net][Windows Version]: PowerShell.AddScript Method (String) question/clarification

$
0
0

Hi All, I’m looking for clarification with the PS.AddScript method. I am using PowerShell version v2.0.50727 and encountered a “Missing closing '}' in statement block.” error while running the following logic. 

Dim exRunSpace As Runspace = RunspaceFactory.CreateRunspace()
Dim ps As PowerShell = PowerShell.Create
Dim command As New PSCommand
…
ps.Streams.ClearStreams()
ps.Streams.Error.Clear()
ps.Commands.Clear()

ps.AddScript("$recipient = Get-Recipient -identity " & upn)
ps.AddScript("If ($recipient –ne $null) {")
ps.AddScript("If ($recipient.RecipientTypeDetails –eq 'MailUser') {")
ps.AddScript("Remove-MailUser -identity " & upn & " -domaincontroller " & dnsHostFQDName & " -WhatIf:$false -Confirm:$false }")
ps.AddScript("If ($recipient.RecipientTypeDetails –eq 'RemoteUserMailbox') {")
ps.AddScript("Remove-RemoteMailbox -identity " & upn & " -domaincontroller " & dnsHostFQDName & " -WhatIf:$false -Confirm:$false }")
ps.AddScript("}")
ps.AddCommand("Out-String")
Dim commandResults As Collection(Of PSObject) = Nothing
If updateOn Then
  commandResults = ps.Invoke()
End If ' updateOn

The ps.Commands(0-8) CommandText contains the text listed below as observed in Debugger. 

$recipient = Get-Recipient -identity 12345678@school.edu
If ($recipient –ne $null) {
If ($recipient.RecipientTypeDetails –eq 'MailUser') {
Remove-MailUser -identity 12345678@school.edu -domaincontroller DOMCTRLR.college.school.tech -WhatIf:$false -Confirm:$false }
If ($recipient.RecipientTypeDetails –eq 'RemoteUserMailbox') {
Remove-RemoteMailbox -identity 12345678@school.edu -domaincontroller DOMCTRLR.college.school.tech -WhatIf:$false -Confirm:$false }
}
Out-String

This looks good and I can paste it into PowerShell_ISE and run it successfully.

The top of the Stack Trace was as follows:

at System.Management.Automation.Parser.ReportException(Object targetObject, Type exceptionType, Token errToken, String resourceIdAndErrorId, Object[] args)

at System.Management.Automation.Tokenizer.Require(TokenId tokenId, String resourceIdAndErrorId, Object[] args)

at System.Management.Automation.Parser.statementBlockRule()

at System.Management.Automation.Parser.IfStatementRule()

at System.Management.Automation.Parser.StatementRule()

After some experimenting I found that the parser prefers that commands not be spanned across separate AddScript entries at least when an “If” statement or curly brace (}) is involved. If I concatenate the “If” statements into a single AddScript command such as below the issue is resolved. 

1. ps.Commands.Clear()
2. psScriptCmd = ""
3. psScriptCmd = "If ($recipient –ne $null) { " & _"If ($recipient.RecipientTypeDetails –eq 'MailUser') { " & _"Remove-MailUser -identity " & upn & " -domaincontroller " & dnsHostFQDName & " -WhatIf:$false -Confirm:$false } " & _"If ($recipient.RecipientTypeDetails –eq 'RemoteUserMailbox') { " & _"Remove-RemoteMailbox -identity " & upn & " -domaincontroller " & dnsHostFQDName & " -WhatIf:$false -Confirm:$false }}"
4. ps.AddScript("$recipient = Get-Recipient -identity " & upn)
5. ps.AddScript(psScriptCmd)
6. ps.AddCommand("Out-String")

Okay, I can adapt even though breaking the script down with different AddScript statements seems cleaner. The part that I struggle with is that I haven’t found a way to add all the commands like in Line 4 above to the psScriptCmd field where I set the PowerShell variable $recipient. Is there a way to add this line into the psScriptCmd field or is there a way that I can keep everything separate in different AddScript statements?



PowerShell-Proxy Virtual Directory

$
0
0

Hello,

I need to know is that PowerShell-Proxy VirtDir folder in "C:\Program Files\Microsoft\V14\Client Access\PowerShell-Proxy" is common for every Exchange Server 2010 or its changing?

Regards.


Ashane Deshapriya ( MCP )

exchange .edb corrupt

$
0
0
hi all,

Had an exchange server go down, got the exchange .edb files only to find its corrupt, tried to use eseutil.exe to repair the file but when I try and open it with ontrack powercontrols saying its corrupt still.

Regards



How do I export database from corrupt exchange EDB files?
I wonder, how can I fix corrupt EDB files issue? I was trying to migrate & convert my EDB file to PST. I had my EDB files back-up but, it seems corrupt now. I need recovery of all Calendars, Contacts, Journals, Distribution List and Tasks from corrupt backup EDB file anyhow. Please suggest some valuable steps for quick procedure.

My mailbox files or folders are been corrupted

$
0
0
help!!!

My mailbox files or folders are been corrupted and i needed to recover damage EDB file data and convert EDB file into outlook...?

Can anyone help me or tell what to forward to do?

Exchange 2003 cluster for back end servers

$
0
0

Hello Friends,

I understand this is very old question but due to political reasons we are still on exchange 2003 and have a new requirement is to install exchange cluster on back end server. From what I understand is we need to install exchange on both the nodes with Microsoft cluster service. I am planning for below deployment process. Kindly correct where ever required.

Step 1 - Share a LUN between both the nodes where EDB and STM and other required files will be located.

Step 2 - On new node install Exchange 2003 with MCS.

Step 3 - Configure using cluster manager and create groups and resources.

Please guide more on this

Retrieval of all users in Exchange online

$
0
0

Exchange Version: Exchange Online at Office 365
API Name: EWS API 2.0
IDE: Visual basic C# 2010
Targeted features: Impersonation and retrieval of all users

Hi there, I am currently developing a program that uses impersonation and queries the EWS API to retrieve emails and their attachments from users. I have used the C# codes from the MSDN Library to develop the program. The program is successful in retrieving the emails from specific users that are hard coded into the program.

The code below shows the process of authenticating the admin user and the impersonation is done in the  RetrieveEmailFromUser() function.

ServicePointManager.ServerCertificateValidationCallback = CertificateValidationCallBack; ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013_SP1); service.Credentials = new NetworkCredential("adminemail@", "password", "domain.onmicrosoft.com"); service.AutodiscoverUrl("adminemail", RedirectionUrlValidationCallback); List<string> emailaddrlist = new List<string>(); emailaddrlist.Add("user1@domain.onmicrosoft.com"); emailaddrlist.Add("test2@domain.onmicrosoft.com"); foreach (string item in emailaddrlist) { string content = RetrieveEmailFromUser(service, item); Console.WriteLine(content); }


        static string RetrieveEmailFromUser(ExchangeService service, string emailAddr)
        {
            service.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, emailAddr);

            FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox, new ItemView(50));

As can be seen from the coding, the users that are to be impersonated have been hardcoded. I would like to know if there are any C# codes or a link to a page where it describes how I can retrieve ALL users with mailboxes from a Microsoft 365 admin account without needing to manually add users for retrieval.

C# Connect To Exchange with EWS

$
0
0

Hello,

I need to create appointments by the connected user using c# code and EWS.

I tried this:

Exchange.Service.UseDefaultCredentials = true;

But I got an 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

 How to solve it?


Exchange EWS API - Marking email as read

$
0
0

Hi,

I'm developing an application which ties in with our Exchange 2013 email server.

However, I'm not to sure how I can mark the email as read after it is opened.

This is my code:

Sub ShowEmail(index As Integer)
        Dim service As New ExchangeService()
  Dim inbox As Folder = Folder.Bind(Service, WellKnownFolderName.Inbox)
        Dim sf As SearchFilter = New SearchFilter.SearchFilterCollection(LogicalOperator.[And], New SearchFilter.IsEqualTo(EmailMessageSchema.IsRead, False))
        Dim view As ItemView = New ItemView(10)
        Dim findResults As FindItemsResults(Of Item) = service.FindItems(WellKnownFolderName.Inbox, sf, view)
        findResults.Items.Item(index).Load()
        WebBrowser1.DocumentText = findResults.Items.Item(index).Body
        EmailFromText.Text = findResults.Items.Item(index).LastModifiedName
        EmailSubjectText.Text = findResults.Items.Item(index).Subject
    End Sub

I've tried the findResults.Items.Item(index).update() function as suggested in other places, however this doesn't work.

Thanks

Exchange Virtualization pre and post check up and recommendation for Single forest environment?

$
0
0

Hi Team,

 For exisiting forest Exchange Server 2010 , IT team decided to migrate to Virtualization platform.

Hence, what are all the Pre and Post check up and basic recommendation for move exchange server to virtual box.


This posting is provided &amp;quot;AS IS&amp;quot; with no warranties and confers no rights! Always test ANY suggestion in a test environment before implementing! http://sesaitech.blogspot.in/

[E2010] [EWS] [C#] [Windows]: Testing connection before calling FindItems

$
0
0

Hello,

I read somewhere that when you call the FindItems method, that it opens and closes the connection for you. Is there a way to verify that the exchange server(s) are up and ready to respond to calls before calling that method?

I have a simple service that manages a mailbox, and there was maintenance done last night, which resulted in a bunch of connection errors, so I want to try and avoid this, without having to stop the service during maintenance.


If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful.

Don't Retire Technet

Error while running 'ldifde.exe' to import the schema file

$
0
0

Hello,

I'm doing a practical in exchange server. I have two servers, First one is the domain controller it's a Server 2012 R2 and the Second one is the server planing to install exchange 2010. it has server 2008 R2. My issue is when i'm trying to setup Exchange Server 2010 it comes error while installing "error while running 'ldifde.exe' to import the schema file" I tried to fix but i couldn't. Please if anyone know about this error give me a solution. 

Regards.


Ashane Deshapriya ( MCP )

Exchange 2013 C# Create Mailboxes

$
0
0

Hello All,

We are prepping for a 2013 upgrade. I am reviewing code for our account creation programs that I wrote in preparation for 2013. Here is a link I found but they have stated that is not the preferred or supported method for mailbox creation for Exchange 2013.

Here

Here is the code I am using on our 2007 Implementation that we will be moving away from: based on what I can see it looks like it will work, but it's essentially the same as what's described above.

public void CreateUserMailbox(string identity, string alias)
        {
            //StreamWriter errorLog = new StreamWriter(@"c:\scripts\logs\AutoAddUsersLog.txt", true);
            ArrayList database = new ArrayList();
            ICollection<PSObject> results;

            // Create a runspace. We can't use the RunspaceInvoke class this time
            // because we need to get at the underlying runspace to explicitly
            // add the commands.
            RunspaceConfiguration rc = RunspaceConfiguration.Create();
            PSSnapInException snapEx = null;
            PSSnapInInfo info = rc.AddPSSnapIn(
                "Microsoft.Exchange.Management.PowerShell.Admin",
                out snapEx);
            Runspace myRunSpace = RunspaceFactory.CreateRunspace(rc);
            myRunSpace.Open();

            // Create a pipeline...
            Pipeline pipeLine = myRunSpace.CreatePipeline();
            Pipeline pipeLine2 = myRunSpace.CreatePipeline();
            Pipeline pipeLine3 = myRunSpace.CreatePipeline();
            Pipeline pipeLine4 = myRunSpace.CreatePipeline();

            using (pipeLine)
            {
                // Create a command object so we can set parameters for selecting the database.
                Command getDatabase = new Command(@"c:\scripts\ADScripts\createusers\Exchange\database.ps1");
                pipeLine.Commands.Add(getDatabase);
                pipeLine.Invoke();
                pipeLine.Commands.Clear();
                // Create new StreamReader to read the file filled with users to the ArrayList
                StreamReader readTxt = new StreamReader(@"c:\temp\db.txt");
                int i = 0;
                while (readTxt.EndOfStream != true)
                {
                    database.Add(readTxt.ReadLine());
                }
                readTxt.Close();
            }
            string[] databaseInfo = database[3].ToString().Replace(@"\", ",").Split(',');
            string databaseServer = databaseInfo[0];
            string databaseName = databaseInfo[1] + @"\" + databaseInfo[2];
            databaseServer = databaseServer.Trim();
            databaseName = databaseName.Trim();
            using (pipeLine2)
            {
                // Create a command object so we can set some parameters
                // for this command.
                Command newMbx = new Command("Enable-Mailbox");
                newMbx.Parameters.Add("Identity", @identity);
                newMbx.Parameters.Add("Alias", alias);
                newMbx.Parameters.Add("Database", @databaseServer + @"\" + databaseName);

                // Add the command we've constructed
                pipeLine2.Commands.Add(newMbx);

                // Execute the pipeline and save the objects returned.
                results = pipeLine2.Invoke();

                // Print out any errors in the pipeline execution
                // NOTE: These error are NOT thrown as exceptions!
                // Be sure to check this to ensure that no errors
                // happened while executing the command.
                if (pipeLine2.Error != null && pipeLine2.Error.Count > 0)
                {
                    errorLog2.WriteLine("ERROR: There were pipeline errors...\n");
                    Trace.WriteLine("ERROR: There were pipeline errors...\n");
                    foreach (object item in pipeLine2.Error.ReadToEnd())
                    {
                        errorLog2.WriteLine("Error: " + item.ToString() + Environment.NewLine);
                        Trace.WriteLine("Error: " + item.ToString() + Environment.NewLine);
                    }
                }

                // Print out the results of the pipeline execution
                if (results != null && results.Count > 0)
                {
                    errorLog2.WriteLine("MAILBOXES CREATED: Created the following      users...\n");
                    Trace.WriteLine("MAILBOXES CREATED: Created the following      users...\n");
                    foreach (PSObject ps in results)
                    {
                        if (ps.Members["UserPrincipalName"].Value != null)
                        {
                            errorLog2.WriteLine("UserPrincipalName: " + ps.Members["UserPrincipalName"].Value + Environment.NewLine);
                            Trace.WriteLine("UserPrincipalName: " + ps.Members["UserPrincipalName"].Value + Environment.NewLine);
                        }
                    }
                }
            }
            Thread.Sleep(10000);
            using (pipeLine3)
            {
                // Modify Mailbox
                pipeLine3.Commands.Clear();
                Command set1 = new Command("Set-CASMailbox");
                set1.Parameters.Add("Identity", identity);
                set1.Parameters.Add("IMAPEnabled", false);
                set1.Parameters.Add("POPEnabled", false);
                pipeLine3.Commands.Add(set1);
                pipeLine3.Invoke();
            }
            Thread.Sleep(10000);
            using (pipeLine4)
            {
                // Set Retention Policy
                pipeLine4.Commands.Clear();
                Command mailRetention = new Command("Set-Mailbox");
                mailRetention.Parameters.Add("Identity", identity);
                mailRetention.Parameters.Add("ManagedFolderMailboxPolicy", @"Mailbox Retention Policy");
                mailRetention.Parameters.Add("ManagedFolderMailboxPolicyAllowed");
                pipeLine4.Commands.Add(mailRetention);
                pipeLine4.Invoke();
            }
            pipeLine = null;
            pipeLine2 = null;
            pipeLine3 = null;
            pipeLine4 = null;
            myRunSpace.Close();
            myRunSpace = null;
        }

The code above may not be the prettiest or most efficient implementation -- I'm not a programmer by trade, I'm a Windows/Citrix/Storage/VMware admin, who happens to write code.

My question is, what is the supported method for doing this programmatically, if there is one, and if there isn't what are other people doing to accomplish this? I have to have a way to do this via a program as this code replaced two FTEs on our User Provisioning team and has essentially accomplished a 100% reduction in human error (assuming what is placed in Lawson is correct).

Thanks!

Viewing all 7132 articles
Browse latest View live