Quantcast
Channel: Outlook for Developers forum
Viewing all 6421 articles
Browse latest View live

How do I use a outlook email group name in C# as determining who someone is?

$
0
0

How do I use a outlook email group name in C# as determining who someone is?

I have been tasked at using a username / email address in a C# program.

Here are the steps that are involved.

  1. A user uses the program that is part of a web based system
  2. somehow the code (html, I suppose) determines who is browsing the web pages.
  3. that username or identity of sorts, is compared to see if it belongs to an email group ID.
  4. then the page activates or deactivates some controls, such as radio buttons, based on whether or not it belongs to one or more email groups.
  5. Please advise.  Where can I go to find samples or examples of the steps to do this task?



About Outlook Web Add-in EWS limitation

$
0
0

Hi,

    I'm working on Outlook Web Add-in that report spam using email by attaching original email as attachment.
    The environment we use the add-in is on-prem exchange 2013 server.

    However, there is a limitation on 1MB data size using "makeEwsRequestAsync" in web add-in.

    And I tried to write a server program to request the EWS api. But this method does not support "CreateItem" and "CreateAttachment" command, which means I cannot add attachment > 1MB to email.

    Since the server is exchange 2013, we cannot use the REST api to do the request.

    Is there any possible workaround? Thanks

Raymond


Exporting metadata from msg files on desktop

$
0
0

Hello,

I need a quick help in completing a tedious task. I have more than 1000 .msg files in a folder on my desktop. I need to export the following information for each file in excel:

1 Date of email received

2 Time of email received

3 From - Name (Sender)

4 From - Email ID (Sender)

5 Subject of email

6 To - Name (Recipient)

7 To - Email ID (Recipient)

8 Body of email

Can this be achieved with a vba macro. Could anyone please help me for completing this task.

Thank you in advance! 

How i can obtain received email protection properties (RMS)?

$
0
0

Hi! I need to obtain list of permissions from received E-mail which protected by RMS. So i need to know all existing in this email security rules and their states (am receiver allowed do something, or no. like using UI button). How i can do this(Or is it possible) in case i`m using Outlook interop assembly for developing my add-in.


How to use RegEX or function in outlook quick steps especially for dates in subject or body?

$
0
0

How can i use RegEX of simple functions in outlook quick steps especially for dates in mail subject or mail body please?

for example when I want to create a new e-mail by quick steps,  I want the date in my subject or body of my email looks like "05 April 2019" or "05/04/2019".

I want to do the same in the body and subject sections of the mail.

Is it possible to do it with REGEX or functions like Today() or Date() or Now() or ...?

Best regards.?

System.NotSupportedException when accessing a variable of IHtmlDocument2.Script in 32 bit outlook after a second navigate

$
0
0

Hello all,

I'm working on an addin in outlook using VB .Net that views an html window in the reading pane using mshtml interface. The page has some javascript code which I call using IHtmlWindow2.execScript. I load the page using IHtmlWindow2.navigate(url) function and access some javascript variables by doing the following:

Dim htmlWindow As IHTMLWindow2
htmlWindow.execScript("x=somefunction();","javascript")
Dim result as String = htmlWindow.document.Script.x.ToString()


This code works fine when I run it from an outlook 64bit instance... running the addin from outlook 32bit instance (whether on 32bit or 64bit machine) it gives System.NotSupportedException after I execute a second navigate on htmlWindow, when I first navigate to the url and execute this code it works with no problem. 
using internet explorer debugger F12Chooser on the loaded page in outlook, the below code is executed with no error and return the required value.

x=somefunction();
window.document.Script.x;

However, I tried a breaking point at 

htmlWindow.execScript("x=somefunction();","javascript")

and executed the same code in the immediate window in visual studio but with another variable name each time after i do a navigate, I get no exception.

htmlWindow.execScript("y=somefunction();","javascript")
MessageBox.Show(htmlWindow.document.Script.y.ToString())

I dont understand this behaviour and I would appreciate any help in this. I suspect it has something to do with some caching but I dont know where, i searched the internet for this wih no success.

Thanx

C# Outlook cannot perform this action on this type of attachment

$
0
0

HI All,

I am trying to save an outlook mail attachment to my local temporary path <g class="gr_ gr_177 gr-alert gr_gramm gr_inline_cards gr_run_anim Style multiReplace" data-gr-id="177" id="177">using </g>

<g class="gr_ gr_177 gr-alert gr_gramm gr_inline_cards gr_disable_anim_appear Style multiReplace" data-gr-id="177" id="177"><g class="gr_ gr_176 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar only-ins doubleReplace replaceWithoutSep" data-gr-id="176" id="176">attachment</g></g>.SaveAsFile(path);

I get an exception like this "Outlook cannot perform this action on this type of attachment."

I am having a mail body with jpeg image. I get this exception when I try to save the attachment to a local path.

The mail attachment types are olByValue and olOLE. I get the exception when the attachment is in the type of <g class="gr_ gr_111 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="111" id="111">olOLE</g>.

How to fix this issue?

Thanks & Regards

Naveen



How to Install Outlook VSTO Addin?

$
0
0

I get this error message when I install my OutlookCRMAddin.

Customized functionality in this application will not work 
because the certificate used to sign the deployment manifest for OutlookCRMAddin is not trusted.
Contact your administrator for further assistance

How to resolve this installation issue?




OUTLOOK.EXE still running in Task Manager

$
0
0
HOW WE CREATE ITEMS IN OUTLOOK FROM C++
We have a TypeLibrary (Visual Studio 2013 C#).  It performs various tasks like creating email and appointments in Outlook.

TLIBIMP.exe (an Embarcadero product) was used on the assembly to create the header files needed for use in the Embarcadero C++ compiler.

THE ISSUE
I noticed that after Invoking the TypeLibrary from our Desktop Application (The one created using the Embarcadero C++ compiler) Outlook.exe remained on the Task List.

I've double and triple checked the C# code and I made sure that I did the following
1.  The Application Object is using the Dispose Pattern to properly release the application object once it goes out of scope.
2.  I'm releasing the RCWs in the reverse order in which they were created.

Outlook is not visible on the screen, only the process is visible on the task list.

Any ideas why Outlook.exe would remain on the task list after Marshal.ReleaseComObject is run on the RCW and then a null is assigned to it (just to be sure I've released the unmanaged resource)?

Germán Hayles


How to target Outlook.com in email

$
0
0

I used to use the code: [owa] .classname{css here}; If I filled the "css here" with for example display: none; the class would hide for outlook.com only.

But this code doesn't work for me anymore. Because of this a great piece of my email doesn't show very well.

Does anyone know if there is a workaround for this?

How to apply a Macro on multiple Outlook folders

$
0
0

I have been able to create a macro to sort messages into a "sender name" subfolder, when I move the message into the parent. for instance:

  1. I receive a message in my inbox.

  2. I move the message into the "follow-up" folder

  3. If there is no subfolder named sender name it is created

    3a. The message is immediately moved into follow-up/sender name

The code below performs these steps perfectly. What I need to do now is apply the code to other folders. At the moment, my code sits in the "ThisOutlookSession" module, because I want it to work automatically.

My question is: How do I apply the macro to multiple subfolders of the inbox? ie:

inbox - not applied here
  follow-up - applied here
  team - applied here
  vendors    - applied here

Here is the code I have so far:

Private WithEvents Items As Outlook.Items

Private Sub Application_Startup()
Dim olApp As Outlook.Application
Dim objNS As Outlook.NameSpace

  ' set object reference to default Inbox
  Set olApp = Outlook.Application
  Set objNS = olApp.GetNamespace("MAPI")
  Set Items = objNS.GetDefaultFolder(olFolderInbox).Folders("Follow-up").Items
End Sub

Private Sub Items_ItemAdd(ByVal item As Object)
' fires when new item added to default Inbox
' (per Application_Startup)

  On Error GoTo ErrorHandler

  Dim Msg As Outlook.MailItem
  Dim olApp As Outlook.Application
  Dim objNS As Outlook.NameSpace
  Dim targetFolder As Outlook.MAPIFolder
  Dim senderName As String

  ' don't do anything for non-Mailitems
  If TypeName(item) <> "MailItem" Then GoTo ProgramExit

  Set Msg = item

  ' move received email to target folder based on sender name
  senderName = Msg.senderName

  If CheckForFolder(senderName) = False Then  ' Folder doesn't exist
    Set targetFolder = CreateSubFolder(senderName)
  Else
    Set olApp = Outlook.Application
    Set objNS = olApp.GetNamespace("MAPI")
    Set targetFolder = objNS.GetDefaultFolder(olFolderInbox).Folders("follow-up").Folders(senderName)
  End If

  Msg.Move targetFolder

ProgramExit:
  Exit Sub
ErrorHandler:
  MsgBox Err.Number & " - " & Err.Description
  Resume ProgramExit
End Sub

Function CheckForFolder(strFolder As String) As Boolean
' looks for subfolder of specified folder, returns TRUE if folder exists.
Dim olApp As Outlook.Application
Dim olNS As Outlook.NameSpace
Dim olInbox As Outlook.MAPIFolder
Dim FolderToCheck As Outlook.MAPIFolder

Set olApp = Outlook.Application
Set olNS = olApp.GetNamespace("MAPI")
Set olInbox = olNS.GetDefaultFolder(olFolderInbox).Folders("follow-up")

' try to set an object reference to specified folder
On Error Resume Next
Set FolderToCheck = olInbox.Folders(strFolder)
On Error GoTo 0

If Not FolderToCheck Is Nothing Then
  CheckForFolder = True
End If

ExitProc:
Set FolderToCheck = Nothing
Set olInbox = Nothing
Set olNS = Nothing
Set olApp = Nothing
End Function

Function CreateSubFolder(strFolder As String) As Outlook.MAPIFolder
' assumes folder doesn't exist, so only call if calling sub knows that
' the folder doesn't exist; returns a folder object to calling sub
Dim olApp As Outlook.Application
Dim olNS As Outlook.NameSpace
Dim olInbox As Outlook.MAPIFolder

Set olApp = Outlook.Application
Set olNS = olApp.GetNamespace("MAPI")
Set olInbox = olNS.GetDefaultFolder(olFolderInbox).Folders("Follow-up")

Set CreateSubFolder = olInbox.Folders.Add(strFolder)

ExitProc:
Set olInbox = Nothing
Set olNS = Nothing
Set olApp = Nothing
End Function

Export account settings on Outlook 2010

$
0
0

Hello,

I will explain my issue with some example.

I add other accounts besides the personal one which is me@mydomain.com, for example they areManagement, Sales and Info.

This configuration is the same for other computer which have installed Outlook 2010 except for the personal email address, but everytime that there is a need, for example one people need to access to the above 3 accounts, I have to reinsert the credential for avery account and it is a waste of time, I tried to import the Registry key of Windows, it works but it import the personal email and I don't want it but only the other accounts.

It is any way to remove for the registry key the personal email and import only the other accounts? Or other method to achieve the same thing without the registry key?



Rules, They are there but for other machine

$
0
0

I can see the rules but they state they are (client only) (for other machine)

I was recently moved to this machine and email pst is on the server and tied to this machine now.

Is there a way to remove from the string in the rules (client only) (for other machine) so they will work?

Manually recreating is posible but would like to avoid that since I have more than 50 rules.

This is Outlook 2007.

Thank you for your help!


Chris Ward

Folder.BeforeItemMove Event Trigger Reversed from Previous Office Version

$
0
0

Since upgrading to Office 365, event Folder.BeforeItemMove (vba) is triggering for the receiving folder instead of the source folder.

For example:

Where previously MyFolder_BeforeItemMove would trigger when an item was moved out of MyFolder, this event is now triggering when an item is moved into MyFolder.

I was unable to find if this was an intended change, bug, or if anyone else had encountered a similar issue.

The event is still firing (as expected) when deleting an item from MyFolder.

Thanks for your help.

Code:

Dim WithEvents objSourceFolder As Folder

Set objSourceFolder = appOutlook.Session.GetDefaultFolder(olFolderInbox)

Private Sub objSourceFolder_BeforeItemMove(ByVal Item As Object, ByVal MoveTo As MAPIFolder, Cancel As Boolean)

Issue to Email sender and receiver

$
0
0
Hi,
I want to know Email here, is exactly sent from INTTRA company, to this Email group - E-BOOK(ZIM-ZSH). Is there any possibility that email is copied within Outlook, by any rules?



Many Thanks & Best Regards, Hua Min



Email saving to a file

$
0
0
With Outlook 2016 in VBA I try to save an email as a file.
I get the error message: Outlook could not complete the saving due to an error with the permission for the file …… ..
I tried to change the permission for the folder where I want to save the file.
Anyone can write in this folder. But that doesn't help.
In Windows explorer I can place files in this folder.
In another vba macro I can write to a folder. So the problem is not in the macro but in the settings of the relevant folder.
What can I do ?

check for non-received emails

$
0
0
Hello,
I have microsoft outlook 2016
Daily I expect to receive 50 emails from clients (One email per clientID- 1 to 50) into an inbox folder I created, [Received] folder in outlook under the inbox folder.
Some days, there may be a few of the emails not received.
At present, at 10 am, daily, I manually check the Received folder to see which ClientID email has not arrived.
The clientID is present in the subject of the email in every email.

Question:
How is it possible, so that automatically I receive an email which shows which of the clientIDs have not sent an email to me yet?
Thank you

Original "start date" of postponed appointment

$
0
0

Hello,

Hopefully someone could help :)

I use VBA code that runs through Microsoft Outlook Appointments, and for each appointment - prints a few details - to an Excel table.

If I set the start date of an appointment on "01-April-2019", and then postpone that appointment to "12-April-2019", and then postpone that appointment to "15-April-2019" - I have 3 "Appointment Item" objects in my folder.
I would like to print for each appointment in the folder - the "Start Date" that was set *originally*.
For example: Print for the first appointment - the first original start date (01-April-2019), for the first postponed appointment - the first postponed start date (12-April-2019), and for the second postponed appointment - the second postponed start date (15-April-2019).

However, when I run my code - the *last* "Start Date" is printed (15-April-2019, 15-April-2019, 15-April-2019), instead of the original (01-April-2019, 12-April-2019, 15-April-2019) .

I read a lot about different types of "date" objects, but couldn't find the correct one.

Could anyone help me?

Thank you very much!

Sub GetFromOutlook()

'Early Binding: Tools > References > Microsoft Outlook xx.0 Object Library > OK

Dim OutlookApp As Outlook.Application
Dim OutlookNS As Namespace
Dim Folder As MAPIFolder
Dim oApp As Outlook.Application
Dim oG As Outlook.Folder  'Method for IMAP, as used by Gmail.
Dim oM As Outlook.MeetingItem
Dim oAA As Outlook.AppointmentItem
Dim oI As Outlook.RecurrencePattern
Dim sMsg$, sAdd$
Dim i As Long
Dim j As Long

Set OutlookApp = New Outlook.Application
Set OutlookNS = OutlookApp.GetNamespace("MAPI")
Set Folder = OutlookNS.GetDefaultFolder(olFolderInbox).Parent.Folders("CCB Meetings")

  
 Dim icon As String
  
  Set oApp = CreateObject("Outlook.Application")
  Set oG = OutlookNS.GetDefaultFolder(olFolderInbox).Parent.Folders("CCB Meetings")
  For i = 1 To oG.Items.Count
    If TypeName(oG.Items(i)) = "MeetingItem" Then j = j + 1
  Next i
  If j = 0 Then Exit Sub

' Create titles
        Range("A1").Offset(0, 0).Value = "SenderName"
        Range("B1").Offset(0, 0).Value = "Subject"
        Range("C1").Offset(0, 0).Value = "CreationTime (Scheduled time of the first appointment)"
        Range("D1").Offset(0, 0).Value = "ReceivedTime (Scheduled time of the current appointment)"
        Range("E1").Offset(0, 0).Value = "Start (start time of the last scheduled appointment)"
        Range("F1").Offset(0, 0).Value = "StartTime (doesnt work yet)"
        Range("G1").Offset(0, 0).Value = "Location"
        Range("H1").Offset(0, 0).Value = "RequiredAttendees"
        Range("I1").Offset(0, 0).Value = "OptionalAttendees"
        Range("J1").Offset(0, 0).Value = "ResponseStatus"


  On Error Resume Next
  j = 0
  For i = 1 To oG.Items.Count
      Set oM = oG.Items(i)
      With oG.Items(i).GetAssociatedAppointment(True)
        j = j + 1
        Range("A1").Offset(j, 0).Value = oM.SenderName
        Range("B1").Offset(j, 0).Value = oM.Subject
        Range("C1").Offset(j, 0).Value = .CreationTime
        Range("D1").Offset(j, 0).Value = oM.ReceivedTime
        Range("E1").Offset(j, 0).Value = .Start
        Range("F1").Offset(j, 0).Value = oAA.GetRecurrencePattern '??????????????????
        Range("G1").Offset(j, 0).Value = .Location
        Range("H1").Offset(j, 0).Value = .RequiredAttendees
        Range("I1").Offset(j, 0).Value = .OptionalAttendees
        Range("J1").Offset(j, 0).Value = .ResponseStatus
      End With
  Next i
  On Error GoTo 0


Set Folder = Nothing
Set OutlookNS = Nothing
Set OutlookApp = Nothing

End Sub



Attachment file name takes on metadata description when message format is HTML but not for RTF message format

$
0
0

We send documents from our in-house Eclipse system that uses VB.net code to open a new email with message format of Rich text.  When attaching files we add some metadata called a description which is the name we want the attachment to display in the email but instead it displays the actual file name.  If we use the HTML message format, the attached file will take on the name set in the description field.  We don't want to use the HTML message format because it does not allow the attachments to be positioned instream and context placed around it.  How can we code so the name of the attached file in the Outlook RTF message format uses the metadata description field for the name instead of the actual file name?  HTML formatted messages do this by default - they use the value in the Description field.

So to clarify - We are sending a document from Eclipse using Outlook as the email client.  The document has some metadata on it called a description which contains the value "test"

The document being attached has the file name C:\Users\XXXXXX\AppData\Roaming\Documents\Cache\000002001\135000003311.PDF.

We default the outlook message to format RTF and the name of the attachment displays as the file name "135000003311.PDF"

If we choose the HTML message format – the attached file name automatically changes to the name in the description field "test"

The section dealing with the attachments starts here: If Not anAttachmentList Is Nothing Then

Public Sub launchMailItem(ByVal aToList As StringCollection _
                                , ByVal anAttachmentList As CodeFieldList _
                                , ByVal anIsFax As Boolean _
                                , ByVal aSubjectLineText As String _
                                , ByVal aSignaturePath As String _
                                , ByVal anEmailReporting As EmailReporting)

            coverLetterFileName = String.Empty
            emailReporter = anEmailReporting
            messageSent = False
            Try
                emailItem = CType(outlookApplication.CreateItem(Outlook.OlItemType.olMailItem),  _
                                  Outlook.MailItem)
                AddHandler emailItem.Send _
                         , AddressOf handleEmailItemSend
                AddHandler emailItem.Close _
                         , AddressOf handleEmailItemClose

                emailItem.SentOnBehalfOfName = _
                                       SessionManager.commonMailBoxName

                emailItem.Subject = aSubjectLineText

                'default the email to Rich Text format
                emailItem.BodyFormat = Outlook.OlBodyFormat.olFormatRichText

                If Not anAttachmentList Is Nothing Then
                    Dim myDisplayName As String
                    For Each myAttachment As CodeField In anAttachmentList
                        myDisplayName = CodeField.getDescriptionString(myAttachment)
                        If myDisplayName = String.Empty AndAlso _
                           System.IO.File.Exists(CodeField.getCodeString(myAttachment)) Then
                            myDisplayName = _
                                System.IO.Path.GetFileName(CodeField.getCodeString(myAttachment))
                        End If
                        emailItem.Attachments.Add(CodeField.getCodeString(myAttachment) _
                                            , _
                                            , 1 _
                                            , myDisplayName)
                    Next
                End If

                Me.checkOutlook(emailItem)

                If outlookApplication.Session.Offline OrElse
                   Not Me.isOutlookOpen Then
                    Throw New EclipseWarningException _
                        ("Outlook is currently offline; Eclipse cannot successfully send mail when outlook is offline.  Please make sure Outlook is open and connected.", _
                        Nothing)
                End If

                If Not Me.isDefaultSignatureExists Then
                    Throw New EclipseWarningException _
                        ("A default signature was not found.  Please set a default signature in Outlook and try again.", _
                        Nothing)
                End If

                If Not String.IsNullOrEmpty(aSignaturePath) Then
                    ''if they have a default signature set we will delete if first
                    DeleteSignature(emailItem)

                    ' ''add the signature to the email
                    InsertSignature(emailItem, aSignaturePath)

                End If

                If aToList IsNot Nothing Then
                    Dim myToString As New StringBuilder
                    For Each mystring As String In aToList
                        myToString.Append(";" & mystring)
                    Next
                    If myToString.Length > 0 Then
                        'remove the first ";"
                        myToString.Remove(0, 1)
                    End If
                    emailItem.To = myToString.ToString
                End If

                postitionEmailCursor(emailItem)

                emailItem.Display()

                'We will capture whenever an email is saved.  It is added after the emailItem.Display statement because
                'the initial opening of the email throws a write event which we will skip.
                AddHandler emailItem.Write _
                         , AddressOf handleEmailItemSave

            Catch ew As EclipseWarningException
                Throw ew
            Catch ex As Exception
                Throw New OutlookLaunchException(ex)
            End Try

        End Sub


Missing push notifications on subscriptions - Outlook API

$
0
0
We are facing an issue in outlook push notification API (Link) in our app. Followings are the parameters:
1. One inbox of office 365 account.
2. Emails coming in for almost every second (60/minute).
3. Number of emails 25,000.

4. In the cycle of these 25,000, we missed almost 100 push notifications.

Questions:

  1. What is the limit of push notifications per inbox, per minute?
  2. What is the maximum email threshold for single inbox, per minute/hour?
  3. What is the maximum threshold for API calls, per inbox, per subscription?
  4. Is there any throttling on the inbox? If yes, when they are coming in the account?

We found these links, but not much helpful.
https://developer.microsoft.com/en-us/graph/blogs/throttling-coming-to-outlook-api-and-microsoft-graph/,https://developer.microsoft.com/en-us/office/blogs/throttling-changes-coming-to-beta-outlook-apis-and-outlook-related-apis-in-microsoft-graph/).



Viewing all 6421 articles
Browse latest View live


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