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

private messaging in webmatrix

$
0
0

Hello, i am new to webmatrix or should i say web application in general. i have read and looked  at the tutorial to see if there is any out there online that talks and teach about sending private message between users just like the facebook website. i want to allow users to be able to send private message to eachother.

I would have given you the code i have so far but like i said, i don't even know how to go about this issue. please help me on this.

N.B

What i really want is not a chat between users that are online but a way of messaging eachother through your web application and not to their email address. Please, urgently.


PowerShell & EMS differences

$
0
0

Hi all,

apologies if this has been asked before but I couldn't find an answer.

If I run this in EMS it works perfectly

$size ='{0:N2}'-f  ((get-mailboxdatabase $_.name -status).databasesize.ToMB()/1024)

However if I run it from PowerShell and I connect to Exchange I get "method invocation failed because....doesn't contain a method named "ToMB"

I would prefer it so it can be run from powershell so that I can add it to the task schedule and to also give it to the support team who may not have access to the exchange server to run it remotely.

TIA

Andy

EWS managed API gett OWA URL for attachments

$
0
0

I see using the property WebClientReadFormQueryString we can get the OWA URL to the email message but how can I get the OWA URL for each FileAttachment?

EMS 2013 Start-Job -InitializationScript {??Launch EMS??}

$
0
0

I am attempting to create a PowerShell script utilizing Start-Job against each Exchange database. How can I possibly initialize the job with the 2013 EMS? In 2010 I was able to initialize by using adding the 2010 snapin but from what I understand adding the 2013 snapin is not supported.

A sample of the beginning of my script is below. The Start-Job code in question is on the last few lines.


# Query all mailbox databases that are members of a DAG and that are not marked as
#  recovery databases.
$DAGDbs = Get-MailboxDatabase | Where-Object {$_.mastertype -eq "DatabaseAvailabilityGroup" -and $_.recovery -ne "true"}

# Use a Foreach loop to process each database.
ForEach ($DAGDb in $DAGDbs){
# Check the running status of jobs generated by this script to help throttle the
#  concurrent jobs.
$CheckJobs = Get-Job -Name *GetMailboxes | Where-Object {$_.State -eq 'Running'}
	# Use the If statement to throttle the number of concurrent jobs to four.
	if ($CheckJobs.count -le 5){
		# When the number of running jobs is less than or equal to four, start
		#  another job using the DAG databases currently being processed within
		#  the ForEach loop.
		Start-Job -Name "$DAGDb GetMailboxes" -InitializationScript {Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010} `
		-ArgumentList ($DAGDb.name, $_) -ScriptBlock {



How parse to Google Calendar Recurrence Rule for Exchange ?

$
0
0

I am writing a migration tool which uses Gmail Api and EWS managed Api.  I ran into a problem of parsing Calendar Recurrence Rule. All I am getting from google Calendar  Api is nothing but a string of RRULE, EXRULE, RDATE and EXDATE for a recurring event. For example :

RRULE:FREQ=WEEKLY;UNTIL=20110701T170000Z

How can I parse this rules to EWS manged Api Recurring event  functions ? EWS managed Api has various sets of functions for creating Recurring events. Any help would be highly appreciated. Maybe some third party library I can use for the same ?

Exchange Online Management cmdlets return Display Name instead of Identity

$
0
0
Hello,

We've got an issue when managing our Exchange Online environment using remote PowerShell.

We use Exchange management cmdlets to manage Exchange Online mailboxes. When we run, for example, theGet-MailboxPermission or Get-RecipientPermission cmdlets, it returns Display Names of the users with mailbox rights. Previously, when we initially tested remote PowerShell with Exchange Online, the cmdlets returned theIdentity property, which is unique and worked well for us. However, currently the cmdlets return theDisplay Name, which is not unique and causes us issues. For example, in our environment there can exist two or more users with the same Display Name (see highlighted on the screenshot):

In cases when only one of the users is granted a permission, we cannot distinguish programmatically, which of the 2 users this is. Also, we cannot run cmdlets, such asGet-SecurityPrincipal, to get more info about the principals who are granted the permission.

Is it possible to get the old behavior of the cmdlets back so that they return the uniqueIdentity instead of the non-unique Display Name? Or how do we workaround this?

Is it possible to schedule a room by sending an ics file?

$
0
0

I'm working on a third party service that creates events and invites a group of participants / rooms to attend those events. I do this by creating .ics files (iCalendar file format) and mailing them (from an outside account) to the participants. This works great for regular attendees. Exchange automatically parses the .ics file and shows the attendee a nicely rendered invite that integrates with the recipient's calendar.

The problem is, I have not been able to use this technique to schedule a room. If I send an invitation to the room's address, the room does not book itself. I've tried everything I can think of. The room is configured to auto-accept invites, and I've looked for permission settings that might influence this feature. I'm starting to think that the behavior I want (scheduling a room in Exchange through an externally generated ics file) is not supported. Has anyone else tried this and been successful? Does anyone know for sure whether this is supported?

FYI I'm testing with Office 365.

Exchange web services not working as aspected (FindItems)?

$
0
0

Hello,

I'm using some scripts from Glen Scales and one of them is to delete some messages from an inbox folder but am running into something strange.

I’m trying to remove email from an inbox folder based on the following AQSString ($AQSString = "System.Subject:" + "Mail Delivery System"). When I run the script 250 emails (from 3000) are deleted. We’re using Exchange 2013 and fors some reason the search results are limited to 250 items. All works well for the 250 emails and they’re deleted. However, when I run the script again 0 items are deleted while there are plenty more available. Only when I adjust the $AQSString by removing e.g. one character the script will run again and delete 250 emails. The value of $AQSString can only be used ones, even when I succesfully run the script again with the adjused string. Here's the code I'm using, what am I missing?

#region prerequisites
## check where the API is installed
If (Test-Path -Path "C:\Program Files\Microsoft\Exchange\Web Services\2.2\Microsoft.Exchange.WebServices.dll"){
      Add-Type -Path "C:\Program Files\Microsoft\Exchange\Web Services\2.2\Microsoft.Exchange.WebServices.dll"}
Else{
      Add-Type -Path "E:\Program Files\Microsoft\Exchange\Web Services\2.2\Microsoft.Exchange.WebServices.dll"}



## Choose to ignore any SSL Warning issues caused by Self Signed Certificates

## Code From http://poshcode.org/624
## Create a compilation environment
$Provider=New-Object Microsoft.CSharp.CSharpCodeProvider
$Compiler=$Provider.CreateCompiler()
$Params=New-Object System.CodeDom.Compiler.CompilerParameters
$Params.GenerateExecutable=$False
$Params.GenerateInMemory=$True
$Params.IncludeDebugInformation=$False
$Params.ReferencedAssemblies.Add("System.DLL") | Out-Null

$TASource=@'
  namespace Local.ToolkitExtensions.Net.CertificatePolicy{
    public class TrustAll : System.Net.ICertificatePolicy {
      public TrustAll() {
      }
      public bool CheckValidationResult(System.Net.ServicePoint sp,
        System.Security.Cryptography.X509Certificates.X509Certificate cert,
        System.Net.WebRequest req, int problem) {
        return true;
      }
    }
  }
'@
$TAResults=$Provider.CompileAssemblyFromSource($Params,$TASource)
$TAAssembly=$TAResults.CompiledAssembly

## We now create an instance of the TrustAll and attach it to the ServicePointManager
$TrustAll=$TAAssembly.CreateInstance("Local.ToolkitExtensions.Net.CertificatePolicy.TrustAll")
[System.Net.ServicePointManager]::CertificatePolicy=$TrustAll


$service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService -ArgumentList ([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2013_SP1)


$uri=[system.URI] "https://[exchange server fqdn]/EWS/Exchange.asmx"
$service.Url = $uri

#Credentials Option 1 using UPN for the windows Account
$creds = New-Object System.Net.NetworkCredential("[account]","[password]")
$service.Credentials = $creds

#endregion prerequisites

cls

#region Script

      $MailboxName = "[mailbox]"
      Write-Host "$MailboxName wordt nu doorzocht..."

      #Bind to Inbox
      $folderid= new-object Microsoft.Exchange.WebServices.Data.FolderId([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Inbox,$MailboxName)
      $Inbox = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($service,$folderid)

      $AQSString = ""
      $AQSString = "System.Subject:" + "Mail Delivery System"

      #Define ItemView to retrieve just 1000 Items
      $ivItemView =  New-Object Microsoft.Exchange.WebServices.Data.ItemView(1000)
      $fiItems = $null

      [INT]$Rcount = 0

      do{
          $fiItems = $service.FindItems($Inbox.Id,$AQSString,$ivItemView)
          #[Void]$service.LoadPropertiesForItems($fiItems,$psPropset)
          foreach($Item in $fiItems.Items){
                  $Rcount++
                  $Item.Delete([Microsoft.Exchange.WebServices.Data.DeleteMode]::HardDelete)
          }
          $ivItemView.Offset += $fiItems.Items.Count
      }while($fiItems.MoreAvailable -eq $true)

$Rcount

#endregion Script

Thnx Remco


Encrypting email in Microsoft.Exchange.WebServices.Data

$
0
0

I am trying to send an encrypted email using Microsoft.Exchange

public void SendMessage(FacadeModel.EmailMessage message)
    {
        var item = new EWS.EmailMessage(_mailService);

        var handler = new SecureMimeMessageHandler();
        byte[] con = handler.encry("test", "me@mail.com.au");

        item.MimeContent = new EWS.MimeContent(Encoding.ASCII.HeaderName, con);
        item.ToRecipients.Add("me@mail.com.au");
        item.From = new EWS.EmailAddress("", "me@mail.com.au");
        item.Body = "test";
        item.Send();

}

public byte[] encry(string body, string to)
    {
        var store = new X509Store(StoreLocation.LocalMachine);
                store.Open(OpenFlags.OpenExistingOnly | OpenFlags.ReadOnly);
                X509Certificate2Collection certs = store.Certificates;

                X509Certificate2 cert1 = GetMatchingCertificate(certs[1], "me@mail.com.au", X509KeyUsageFlags.KeyEncipherment);

        StringBuilder msg = new StringBuilder();
        msg.AppendLine(string.Format("Content-Type: application/pkcs7-mime; smime-type=signed-data;name=smime.p7m"));
        msg.AppendLine("Content-Transfer-Encoding: 7bit");
        msg.AppendLine();
        msg.AppendLine(body);
        EnvelopedCms envelope = new EnvelopedCms(new ContentInfo(Encoding.UTF8.GetBytes(msg.ToString())));
        CmsRecipient recipient = new CmsRecipient(SubjectIdentifierType.IssuerAndSerialNumber, cert1);
        envelope.Encrypt(recipient);

        return envelope.Encode();

    }

But still i am getting a plain email with no encryption in outlook. where have i gone wrong?


[E2010] [TA] [C#] [Windows]: convert plaintext message to html

$
0
0

Hello,

i'm writing transport agent for exchange server 2010. I sucessfully catch mesage in pipeline on OnEndOfDataHandler event and work with EmailMessage and Body classes. My aim is convert all plaintext message to html for adding after signature(html format) that has hyperlinks, otherwise my message will be ugly where hyperlinks divided on link and name of link.

I try follow and get plaintext mesage with html tags in body, what should do to right convert message. Any help will very useful for me. Thank you.

public void OnEndOfDataHandler(ReceiveMessageEventSource source, EndOfDataEventArgs eodArgs)
{
EmailMessage message = eodArgs.MailItem.Message;
Stream originalBodyContent = null;
Stream newBodyContent = null;
Encoding encoding;
string charsetName;
try
            {

                Body body = message.Body;
                BodyFormat bodyFormat = body.BodyFormat;

                if (!body.TryGetContentReadStream(out originalBodyContent))
                {
                    return;
                }
if (BodyFormat.Text == bodyFormat)
                {
                    charsetName = body.CharsetName;
                    if (null == charsetName ||                !Microsoft.Exchange.Data.Globalization.Charset.TryGetEncoding(charsetName, out encoding))
                    {
                        return;
                    }

                    TextToHtml textToHtmlConversion = new TextToHtml();

                    textToHtmlConversion.InputEncoding = encoding;

                    textToHtmlConversion.HeaderFooterFormat = HeaderFooterFormat.Html;

                    newBodyContent = body.GetContentWriteStream();

                    try
                    {
                     textToHtmlConversion.Convert(originalBodyContent, newBodyContent);
                    }
                    catch (Microsoft.Exchange.Data.TextConverters.TextConvertersException)
                    {
                        // the conversion has failed..
                    }

                }
          }
}


Is it possible to skip some of the Rollup after applied the Exchange 2007 SP3

$
0
0
Is it possible to skip some of the Rollup after I applied the Exchange 2007 SP3,Such as: Skip install the rollup from 1 to 7 and installed only from 8 to 13?

Finding number of connected users to Exchange ActiveSync

$
0
0

Hi,

We want to find no. of connected users/Devices to Exchange ActiveSync.

Get-MobileDeviceStatistics cmdlet retrieves the list of mobile devices configured to synchronize with a specified user's mailbox and return a list of statistics about the mobile devices.

But, we want to find devices currently connected to EAS.

 

Is there any way to get the information about devices connected/ synchronizing in real-time?

 

Any pointers or help is appreciated.

Thank you.


Sandeep Gupta

Transport Agent Text To HTML Conversion Problem

$
0
0

I have been building a transport agent that works fine except when I have to convert a plain text email to html. I have been looking for samples on how to use the textconverters and texttohtml. However, I'm not sure what they really are supposed to do. If I use it to convert the body it will convert what was plain text to html as in the example below...but it never converts the actual body type to html so it's still a plain text email with a body that has html text in it. Therefore, when read...it doesn't display properly. Are the converters supposed to change the mail body type also? Can you change the mail body type?

<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii">

<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text -->
<style><!-- .EmailQuote { margin- padding- border- } --></style></head>
<body>
<font size="2"><span style="font-size:10pt;"><div class="PlainText">Hello<br>
</div></span></font>
</body>
</html>

Exchange Powershell script gives dr Watson

$
0
0

Hi,

When running a powershell (scheduled) through a batchfile I get a dr. Watson error:

WARNING: An unexpected error has occurred and a Watson dump is being generated:
 Operation is not valid due to the current state of the object.
Get-ActiveSyncDeviceStatistics : Operation is not valid due to the current
state of the object.
At D:\Scripts\ActiveSyncExport.ps1:34 char:27
+ $Devices = $Mailboxes | %{Get-ActiveSyncDeviceStatistics -Mailbox
$_.Identity} | ...
+                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-ActiveSyncDeviceStatistic
   s], InvalidOperationException
    + FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.Excha
   nge.Management.Tasks.GetMobileDeviceStatistics

But when I run this script from the Exchange Management Shell manually it works normally.

I tried this in the script, but that doesn't work either:

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://casserver.ourdomain.com/PowerShell/ -Authentication Kerberos
Import-PSSession $Session

The servers are running Exchange 2010 SP3 with rollup 2.

It looks like a sort of buffer overflow error.

Does anybody know a solution?

How to count number of attachments in a mailbox?

$
0
0

Hi everybody,

I want to count the number of attachments in mailbox. Kindly help me.

Thanks & regards,

Talib Hussain





How to use EWS SearchFilter to only find emails with attachments through service.finditems

$
0
0

Through EWS, I'm able to locate a folder and walk its emails while checking each one for attachments.  But, it would be faster if I can get the finditems method to ONLY return emails with attachments so I don't have to check each one as I walk through them.

I've figured this is only a matter of specifying the correct SearchFilter so that only items with attachments are returned.  But, I have no idea how to design such a filter.  I've tried the following:

SearchFilter.IsEqualTo sfEmailsWithAttachments = new SearchFilter.IsEqualTo();
sfEmailsWithAttachments.PropertyDefinition = EmailMessageSchema.Attachments; //field to search on
sfEmailsWithAttachments.Value = null;//value to check for
But, EWS doesn't recognize this as a valid way to use the Attachments property in a search.  I've looked everywhere on the internet and haven't been able to find an example to filter attachments in EWS.  Everyone seems to walk the returned items and check each one for attachments.  If an inbox has thousands of emails, which only a few have attachments, this can take an uneccesary long time.

Any ideas on how to restrict the search to only emails with attachments?



[EWS][Java] How can I use the Search Filter only mails with attachments?

$
0
0

Hey,

I'm trying to search a folder ( doesn't matter  which ) for ONLY mails with attachments.
How can I use the search filter for that purpose? 

Thanks!

List of all HTTP error codes returned by EWS

$
0
0

Hi everybody,

I need all the HTTP error codes returned by Exchange when we use Exchange Web Services.

Thanks & regards,

Talib Hussain


Exchange Connectivity Tool - MAPI Address Book endpoint error

$
0
0

We have Exchange 2007 installed and are now running into a problem with Outlook Anywhere when we introduced new 2012 Domain Controllers.

I have ran the outlook anywhere tests from the Micorosft site and run into a failure when the MAPI Address Book test occurs. It will complete fine when it connects to a 2003 domain controller, but not the 2012 domain controllers.

I have confirmed I get the right response form the 2012 domain controller when I telnet to port 6004. I confirmed there is no ipv6 on any of the servers and I can ping the netbios name and FQDN of the server from the CAS server. There is no firewall in between the machines

Please see the results returned.

The server returned by the Referral service: DC2K1201.domain.local

Elapsed Time: 1280 ms.

Testing the MAPI Address Book endpoint on the Exchange server.
An error occurred while testing the address book endpoint.
Additional Details
Elapsed Time: 3116 ms.
Test Steps
Attempting to ping the MAPI Address Book endpoint with identity: DC2K1201.domain.local:6004.
The attempt to ping the endpoint failed.

Reason :- RPC_S_SERVER_UNAVAILABLE error (0x6ba) was thrown by the RPC Runtime process.

Streaming subscription without Managed API

$
0
0

I am currently investigating Streaming subscriptions.

Due to platform limitations we cannot use EWS Managed API which provides the StreamingSubscriptionConnection.

According to How to: Stream notifications about mailbox events by using EWS in Exchange you would use a GetStreamingEvents EWS call to retrieve notifications.

Are there any ressources about implementing your own StreamingSubscriptionConnection as a Keep-alive socket Connection? I would like to get updates in real time, not every 15min or the like with a GetStreamingEvents call.

The main issue we have are customers with very large Folders (10k+ items) who do not want to synchronize the whole Folder to the device (Smartphone). As the syncFolderItems Operation cannot be limited we are looking into alternatives for These customers.

Viewing all 7132 articles
Browse latest View live


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