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

Access an Outlook 2013 Mail App through Code

$
0
0

Hello Guys,

I have a requirement where-in I want an installed Outlook 2013 mail app to be opened when clicking on a custom ribbon button


My Approach is as follows:
1. Create Outlook Add-in Project
2. Add a Ribbon Project (Visual Designer) to the Add-in Project  and add a button on the Ribbon
3. Retrieve the selected Mail Item
4. When the user clicks on the Ribbon, access the app bar and invoke the app for the selected Mail Item

I am stuck on #4.

I have two questions:

1. Is this possible? i.e. Can we invoke an office 2013 mail app when we click a Ribbon button?

2. If the Answer to #1 is yes, How can I do this using code(C# code in the add-in) ?




Confirmation on Meeting update Outlook 2013

$
0
0

HI.

Im sorry if I misplace this post it's more like a how-to question, ive searched for the answer but cannot find any.

i've notice that my outlook doesn't ask for any confimation if i move a appointment in my calendar.

Is there any setting i can make so outlook will ask "if i really want to move" an appointment to another date/ time with the "Drag drop function" ?




Excel VBA avoiding the TITUS pop up box in outlook

$
0
0

Hi All,

I am using following code in excel 2010 to automate sending outlook email with pdf attachement.

Sub test()
Dim AOMSOutlook As Object
    Dim AOMailMsg As Object
    Set AOMSOutlook = CreateObject("Outlook.Application")
    Dim objUserProperty As Object
    'Const olMailItem = 0
    Dim OStrTITUS As String
    Dim lStrInternal As String
    Set AOMailMsg = AOMSOutlook.CreateItem(0)
    Set objUserProperty = _
        AOMailMsg.UserProperties.Add("TITUSAutomatedClassification", 1)
    objUserProperty.Value = "TLPropertyRoot=ABCDE;Classification=Internal;Registered to:My Companies;"
    With AOMailMsg
            .To = "sam.jac@bbb.com"
            .Subject = "New Report"
            .Body = "See attached PDF"
            '.Attachments.Add (AttachmentPath)
            .Save
            .Send
    End With
          Set AOMailMsg = Nothing
          Set objUserProperty = Nothing
          Set AOMSOutlook = Nothing
          Set lOMailMsg = Nothing
          Set objUserProperty = Nothing
          Set lOMSOutlook = Nothing
End Sub

The code works but eveytime Titus pop up prompts to select CLASSIFICATION (Internal or General business). My code automatically selects classification as "Internal"but I want code shall automatically click "OK" on that pop up.

Is it possible to do that using excel vba?

Thanks,

Zaveri





Communication between Form Region and Ribbon

$
0
0

Hey everyone, 

I am working on an Addin for Outlook and part of the Addin has a custom Form Region and a button in the Ribbon. My end goal is when pressing that button add an item into the Form Region which I got working 1 way however it is requiring me to find my instance by using a foreach and checking for an instance of my object. 

Some documentation I found http://msdn.microsoft.com/en-us/library/bb772084.aspx and that got me started however two of the methods do not work for me, just the last.

Now, the first method (very similar to the second), uses Globals to get the Form Region in specific Inspectors/Explorers. This seems like the easiest (and best) way to do it, and its shown below.

private void Access_Form_Regions_ByInspector()
{
    WindowFormRegionCollection formRegions = 
        Globals.FormRegions
            [Globals.ThisAddIn.Application.ActiveInspector()];
    formRegions.FormRegion1.textBox1.Text = "Hello World";
}

Now, FormRegion1 is a Form Region (if I understand this correctly), however my IDE does not suggest nor know that my Form Region is even available to use from this and this is where I'm lost. 

Using this method I can get my instance and add all the items I want however I do not want to have to search through all of the available Form Regions when I should be able to do this without it.

internal void Access_All_Form_Regions()
{
    foreach (Microsoft.Office.Tools.Outlook.IFormRegion formRegion 
        in Globals.FormRegions)
    {
        if (formRegion is FormRegion1)
        {
            FormRegion1 formRegion1 = (FormRegion1)formRegion;
            formRegion1.textBox1.Text = "Hello World";
        }
    }

}

I'm not sure if I'm missing something but the documentation does not seem to be making sense here at all, and I have went through all of the related documents looking to see if I missed something and I don't see how I did.

 Side note: I am building the form in VS, I did not create it in Outlook and import into my project.

Business Contact Manager/Outlook 2013/VBA - Task status not updating

$
0
0

I am attempting to slightly modify the example shown here:

http://msdn.microsoft.com/en-us/library/office/bb268004(v=office.12).aspx

(code to send an email when a Business Project status is updated).  I'm trying to also make it so that an email is sent when a Project TASK is updated.  Here is what I've got:

' In ThisOutlookSession

Option Explicit
Dim WithEvents inspectors As inspectors
Dim WithEvents project As TaskItem
Dim root As Folder

Private Sub Application_Startup()
    Set inspectors = Application.inspectors
    Set root = Application.Session.Folders("Business Contact Manager")
    Set project = root.Folders("Business Records").Folders("Business Projects").Items(1)
End Sub
Private Sub inspectors_NewInspector(ByVal inspector As inspector)
    If inspector.CurrentItem.Class <> olTask Then Exit Sub
    Dim oTaskItem As TaskItem
    Set oTaskItem = inspector.CurrentItem
    If oTaskItem.MessageClass <> "IPM.Task.BCM.Project" And oTaskItem.MessageClass <> "IPM.Task.BCM.ProjectTask" Then Return
    Dim oProjectWrapper As New ProjectWrapper
    oProjectWrapper.Init inspector
End Sub
' In Class Module ProjectWrapper

Option Explicit
Dim WithEvents inspector As inspector
Dim WithEvents project As TaskItem
Dim self As ProjectWrapper
Dim originalProjectStatus As String

Public Sub Init(anInspector As inspector)
    Set self = Me
    Set inspector = anInspector
    Set project = inspector.CurrentItem
End Sub

Private Sub inspector_Close()
    Set self = Nothing
End Sub

Private Sub project_Open(Cancel As Boolean)
    If project.MessageClass = "IPM.Task.BCM.Project" Then
    originalProjectStatus = project.UserProperties.Item("Project Status").Value 'This line is the original
    ElseIf project.MessageClass = "IPM.Task.BCM.ProjectTask" Then
    originalProjectStatus = project.UserProperties.Item("ActivityStatus").Value
    End If
    MsgBox "Original: " & originalProjectStatus
End Sub

Private Sub project_Write(Cancel As Boolean)
    Dim projectStatus As String
    If project.MessageClass = "IPM.Task.BCM.Project" Then
    projectStatus = project.UserProperties.Item("Project Status").Value 'This line is the original
    ElseIf project.MessageClass = "IPM.Task.BCM.ProjectTask" Then
    projectStatus = project.UserProperties.Item("ActivityStatus").Value
    End If
    MsgBox "New: " & projectStatus

    If originalProjectStatus <> projectStatus Then
        originalProjectStatus = projectStatus
        Dim mail As MailItem
        Set mail = Application.CreateItem(olMailItem)
        mail.Subject = "Project Status changed"
        mail.Body = "Project """ + project.Subject + """ changed. New Project Status: " + projectStatus
        mail.To = "someone@example.com"
        mail.Send
    End If

End Sub

I added the MsgBoxes so that I could see what exactly was being sent.  The code works when a Business Project status is updated -- the MsgBox shows the original status when you first open it, the new status when you save it, and it sends the email.

But with the Project Task, the MsgBox shows the original status when you open the Task, and it still shows the original status even after you change it and save the task.  And it doesn't send the email.  If I take out the If statement at the end (If originalProjectStatus <> projectStatus Then), it does send the email then, but it sends it with the original Task status before it was changed.

So, for some reason, it seems like the Task status isn't getting saved or registered at the time the Task is actually saved.  Am I missing something obvious, or do I need to go about this a different way?  Thanks for any help you can provide.


Outlook 2007 Contact Form Two Pages

$
0
0

I have a new contact form that has the normal fields in it, including the webpage for the contact.  Is there a way to add a new field to the contact form that is another webpage and does not simply be the same webpage from the first webpage field?

Excel

Redemption.RDOStoresClass.GetSharedMailbox ambiguity

$
0
0

Hi,

We are trying to implement a product which performs a MAPI crawl of Outlook mailboxes but fails on some reporting an ambiguous MAPI property shown below. Outlook 2013 SP1 is installed on the server machine from which this product runs. 

Here is the error:

ExchangeService.GetMailboxByAccount -  location {020FEC2E-A2BB-4C56-A427-67E61CD71693}

====

Exception Level 1: System.Runtime.InteropServices.COMException

Message: Error in IAddrBook.ResolveName:MAPI_E_AMBIGUOUS_RECIP

Source: Redemption.RDOStores

Target Site: Redemption.RDOStoresClass

Stack Trace:

at Redemption.RDOStoresClass.GetSharedMailbox(Object NameOrAddressOrObject)

   at DocAuto.Exchange.Implementations.ExchangeService.GetMailboxByAccount(String accountName)

Inner Exception:(null)

The mailbox for user davidc is one such account for which the equivalent powershell command returns no ambiguity. In fact we can't see that the sAmAccountName or the displayname is duplicated and nor are there any trailing spaces. 

Get-mailbox | where {$_.emailaddresses -like "smtp: david.carter@acme.ie"} | ft name, alias

How would you suggest that we could troubleshoot this? I have downloaded MFCMAPI.exe and 

Thanks, Harry


Appointment Propertycahnge event fires many times when we add attendess

$
0
0

Hi,

i have devolved a com addin running on oulook 2010(14.0.7012.1000) SP2.  i have code in the addin which will monitor whenever attendess are added or removed from meeting in the inspector window. it build a list of attendess evrytime it finds that there is change in previous saved list and that happens when you add or remove attendee

What i found is that adding or removing an attendee action fires property change event many times and its requiredattendee and optionalateendee and resources property which is being changed many times. when i was debugging it, i found some of the already existing attendee were added and removed from recipients object many times, so, for example if i have added 4 ateendee and then removing one was firing propertychnage event many times and each time recipient count was coming different, sometimee it comes out to 2 and then 1 and then agian 2 and then again 3.  i am anot sure about the exact pattern because everytime it was different.

The firing of the event may vary depending  on how many attendees are there and this repetition is making my addin slow at this stage. let me know if this is how it suppose to work or if there is any problem in the code.

Here is my code.

Assume AppItem has been initialised already and is of appointment type

ItemOpen and RoomBookingPage are true.

The NAR function will release com object


Private Sub AppItem_PropertyChange(ByVal Name As String) Handles AppItem.PropertyChange If (ItemOpen And RoomBookingPage) Then 'Pass relevant changes to the web page Case "OptionalAttendees", "RequiredAttendees" Dim AttendeeList As String = GetRecipients() If Attendees <> AttendeeList Then SetPageProperty(Browser, "attendees", AttendeeList) Attendees = AttendeeList End If

End Select

End if End Sub Public Function GetRecipients(Optional ByVal IsUrlString = False) As String Dim strRecipients As String = "" strRecipients = GetOutlookRecipients(IsUrlString) GetRecipients = strRecipients End Function Public Function GetOutlookRecipients(ByVal UrlString As Boolean) As String Dim strRecipients As String = "[" Dim strNameAddress As String Dim Recipients As Outlook.Recipients = Nothing Dim RecipientIndex As Integer = 1 Dim Count As Integer Try Recipients = AppItem.Recipients Count = Recipients.Count() Dim recipient As Outlook.Recipient = Nothing If Count > 0 Then Do While RecipientIndex <= Count recipient = Recipients(RecipientIndex) strNameAddress = GetRecipientAddress(recipient, IsUrlString:=UrlString) NAR(recipient) If strRecipients <> "[" Then strRecipients = strRecipients & "," strRecipients = strRecipients & strNameAddress RecipientIndex = RecipientIndex + 1 Loop End If Catch ex As System.Exception strRecipients = "[" End Try GetOutlookRecipients = strRecipients & "]" Log("GetOutlookRecipients : " & GetOutlookRecipients) NAR(Recipients) End Function Public Function GetRecipientAddress(ByVal Recipient As Outlook.Recipient, Optional ByVal AddressOnly As Boolean = False, Optional ByVal IsUrlString As Boolean = False) As String Dim Name As String = Recipient.Name Dim Address As String = Recipient.Address GetRecipientAddress = "" Recipient.Resolve() If (Address Is Nothing) Then 'try one more time to get Address, some how expression at prvious try was not evaluted Address = Recipient.Address End If If Recipient.Resolved Then Dim AddressEntry As AddressEntry = Recipient.AddressEntry Log("GetRecipientAddress: AddressEntry type " + AddressEntry.AddressEntryUserType.ToString) Select Case AddressEntry.AddressEntryUserType Case OlAddressEntryUserType.olSmtpAddressEntry Case OlAddressEntryUserType.olExchangeUserAddressEntry, OlAddressEntryUserType.olExchangeRemoteUserAddressEntry Log("GetRecipientAddress: Member of olExchangeUserAddressEntry or olExchangeRemoteUserAddressEntry") Dim oEU As Outlook.ExchangeUser = AddressEntry.GetExchangeUser If Not (oEU Is Nothing) Then Address = oEU.PrimarySmtpAddress End If NAR(oEU) Case OlAddressEntryUserType.olExchangeDistributionListAddressEntry Log("GetRecipientAddress: Member of olExchangeDistributionListAddressEntry") Dim oEDL As Outlook.ExchangeDistributionList = AddressEntry.GetExchangeDistributionList If Not (oEDL Is Nothing) Then Dim Members As Outlook.AddressEntries = oEDL.GetExchangeDistributionListMembers Dim Member As Outlook.AddressEntry Dim oEU As Outlook.ExchangeUser Dim i As Integer For i = 1 To Members.Count Member = Members(i) oEU = Member.GetExchangeUser If AddressOnly Then GetRecipientAddress = GetRecipientAddress & oEU.PrimarySmtpAddress & "," Else GetRecipientAddress = GetRecipientAddress & "{name: \""" & oEU.LastName & "," & oEU.FirstName & "\"", address: \""" & oEU.PrimarySmtpAddress & "\""}," End If NAR(Member) NAR(oEU) Next i GetRecipientAddress = Left(GetRecipientAddress, Len(GetRecipientAddress) - 1) NAR(Members) Else Log("GetRecipientAddress: cannot resolve ExchangeDistributionList") End If NAR(oEDL) End Select Else Log("GetRecipientAddress: Recipient failed to resolve") End If Log("GetRecipientAddress: In GetRecipient Addrees " + GetRecipientAddress) If GetRecipientAddress = "" Then If AddressOnly Then GetRecipientAddress = Address Else If (IsUrlString) Then Name = Replace(Replace(EscapeDataString(Name), "%5C", "%5C%5C%5C%5C"), "%22", "%5C%5c%5c%22") Else 'MsgBox(Chr(22)) Name = Replace(Replace(Name, "\", "\\\\"), ControlChars.Quote, "\\\" + ControlChars.Quote) End If If (Address Is Nothing) Then Address = Name ElseIf (IsUrlString) Then Address = Replace(Replace(EscapeDataString(Address), "%5C", "%5C%5C%5C%5C"), "%22", "%5C%5c%5c%22") Else Address = Replace(Replace(Address, "\", "\\\\"), ControlChars.Quote, "\\\" + ControlChars.Quote) End If GetRecipientAddress = "{name: \""" & Name & "\"", address: \""" & Address & "\""}" End If End If End Function Private Sub NAR(ByRef o As Object) Dim Count As Integer = 1 Try 'While Count > 0 Count = System.Runtime.InteropServices.Marshal.ReleaseComObject(o) 'Log("Released object: count=" & Count) 'End While Catch Finally o = Nothing End Try End Sub


Thanks

IncludeRecurrences in 2013 - Documentation says do not use?

$
0
0

Hi,

The MSDN Documentation for IncludeRecurrences (2013) states: "Getting or setting this property has no effect.  Do not use it.", followed by information on how/when to use it.

http://msdn.microsoft.com/en-us/library/office/ff866969(v=office.15).aspx

The same property under 2010 documentation is missing the "do not use" note.

Can someone please clarify, and possibly advise how I'm supposed to get recurring appointments within a time range without the property, unless I'm going to calculate them all on my own?

Thanks


Jack D. Leach (Access MVP)
Dymeng Services (home | blog)
UtterAccess Wiki (hundreds of articles and functions)

CHARTS & GRAPHS? How to create reports / dashboard inside of Outlook (2007-2013)?

$
0
0

OBJECTIVE: Trying to create a dashboard with Charts and Graphs...specifically..

  1. Trying to create two interactive dashboards in Outlook. One for email. One for meetings / appointments. Will include..
  2. Tables of data
  3. Graphs / charts
  4. Filter by date (e.g., Today, This Week, a specific date range)
  5. Needs to be compatible with Outlook 2007-2013

QUESTIONS:

  1. APPROACH: Does it make sense to display the dashboard as custom home page on a folder, or__?
  2. CHARTS: I haven't seen any built-in charting / graph capabilities in Outlook. Does it have any I missed? Are there 3rd party components needed? Can you use Javascript libraries (e.g., http://www.chartjs.org/) and present the Dashboard as a local HTML page?
  3. ADD-IN REQUIRED? Can I do this all in VBA, or do I need to write an add-in?

Any pointers / suggestions are appreciated!

"The message you specified cannot be found" exception is thrown when new mail attachment is read.

$
0
0

I am first creating outlook rule during outlook start up event using below code:

private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {

                  CreateRules(this.Application);

this.Application.NewMailEx += new Outlook.ApplicationEvents_11_NewMailExEventHandler(Application_NewMailEx);  

#region toolbar items
                //RemoveMenubar();
                selectExplorers = this.Application.Explorers;
                selectExplorers.NewExplorer += new Outlook.ExplorersEvents_NewExplorerEventHandler(newExplorer_Event);
                AddToolbar();
                #endregion             

         }

private void CreateRules(Microsoft.Office.Interop.Outlook.Application OutlookApp)
        {
            Outlook.NameSpace session = null;
            Outlook.Store store = null;
            Outlook.Rules rules = null;
            Outlook.MAPIFolder destinationFolder = null;
            Outlook.MAPIFolder rootFolder = null;
            Outlook.Folders rootFolderFolders = null;

            Outlook.Rule rule = null;
            Outlook.RuleConditions ruleConditions = null;
            Outlook.TextRuleCondition subjectTextRuleCondition = null;

            Outlook.RuleActions ruleActions = null;
            Outlook.MoveOrCopyRuleAction moveRuleAction = null;



            try
            {
                session = OutlookApp.Session;
                store = session.DefaultStore;
                rules = store.GetRules();

                if (!RuleExist(mRuleName, rules))
                {
                    rootFolder = store.GetRootFolder();
                    destinationFolder = GetFolder(rootFolder.FolderPath + "\\" + mIncidentMailFolder, OutlookApp);

                    if (destinationFolder == null)
                    {
                        rootFolderFolders = rootFolder.Folders;
                        destinationFolder = rootFolderFolders.Add(mIncidentMailFolder);
                    }

                    rule = rules.Create(mRuleName, Outlook.OlRuleType.olRuleReceive);
                    ruleConditions = rule.Conditions;

                    subjectTextRuleCondition = ruleConditions.Subject;
                    subjectTextRuleCondition.Text = new string[] { mSubject };
                    subjectTextRuleCondition.Enabled = true;

                    ruleActions = rule.Actions;
                    moveRuleAction = ruleActions.MoveToFolder;
                    moveRuleAction.Folder = destinationFolder;
                    moveRuleAction.Enabled = true;
                    ruleActions.DesktopAlert.Enabled = true;


                    rules.Save(true);

                    foreach (Outlook.Folder fd in rootFolder.Folders)
                    {
                        if (fd.Name == "Inbox")
                        {
                            rule.Execute(true, fd, true);
                        }
                    }

                }

            }
            catch (Exception ex)
            {
                Debug.Write(ex.Message);
            }
            finally
            {
                if (moveRuleAction != null)
                    Marshal.ReleaseComObject(moveRuleAction);
                if (ruleActions != null)
                    Marshal.ReleaseComObject(ruleActions);
                if (subjectTextRuleCondition != null)
                    Marshal.ReleaseComObject(subjectTextRuleCondition);
                if (ruleConditions != null)
                    Marshal.ReleaseComObject(ruleConditions);
                if (rule != null)
                    Marshal.ReleaseComObject(rule);
                if (rootFolderFolders != null)
                    Marshal.ReleaseComObject(rootFolderFolders);
                if (rootFolder != null)
                    Marshal.ReleaseComObject(rootFolder);
                if (destinationFolder != null)
                    Marshal.ReleaseComObject(destinationFolder);
                if (rules != null)
                    Marshal.ReleaseComObject(rules);
                if (store != null)
                    Marshal.ReleaseComObject(store);
                if (session != null)
                {
                    Marshal.ReleaseComObject(session);
                    session = null;
                }
                if (OutlookApp != null)
                {
                    Marshal.ReleaseComObject(OutlookApp);
                    OutlookApp = null;
                }
            }
        }

Thereafter I am reading the new mail with particular subject and attachment using below code                                                         

void Application_New

MailEx(string EntryIDCollection)
        {
            Outlook.MAPIFolder inBox = (Outlook.MAPIFolder)this.Application.ActiveExplorer().Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);

            //Outlook.MAPIFolder destFolder = null;
            //GetFolderByName(sIncidentMailFolder, ref destFolder);

            Outlook.MailItem newMail = (Outlook.MailItem)Application.Session.GetItemFromID(EntryIDCollection, System.Reflection.Missing.Value);
            if (newMail != null)
            {
                if (newMail.Subject.ToUpper().Contains(mSubject.ToUpper()))
                {
                 if (newMail .Attachments.Count > 0)
                            ProcessIncidentMail(newMail);

                }
            }
        }

newMail .Attachments.Count throws the exception "The message you specified cannot be found"(newMail.Subject shows correct subject and it's not null) for the first time the new mail is received after rule creation in first step. If the same mail with attachment is send again this exception does not occurs and everything works fine.

Also note that if I comment out rule creation code part only then , newMail .Attachments.Count is not throwing any exception for the first time when new mail is sent with attachment, but I need to create rule first.

Please advice.

Thanks in advance!

How to distinguish between incoming and outgoing emails using MAPI Advise Sink Notifications?

$
0
0

Hi everybody,

I am struck in a problem. I don't know how to distinguish between incoming and outgoing emails using MAPI notifications? I have implemented Advise Sink notifications on message store. I am using the following code (as given in MFCMAPI).

for ( ULONG i = 0; i < cNotify; i++ )
	if ( fnevObjectCreated == lpNotifications[i].ulEventType )
		if ( lpNotifications[i].info.obj.ulObjType == MAPI_MESSAGE )
		{
			...
		}

Kindly help me.

Thanks & regards

Talib Hussain



Proper use of Function

$
0
0

Hello,

  • I have a perfectly working piece of code in the ThisOutlookSession that traps when the user is sending an email with aApplication_ItemSend in order toadd a characteristic to all sent emails at the beginning of the subject (P- for Product,S- for Service).  From ThisOutlookSession I call the AddCharacteristic function which in turns make use of the UserForm to do it.

I have a couple of questions:

  1. I was told that The ItemSend event is not a suitable place for displaying any dialog windows (userForm) because they block the UI thread. Is this the case and do you see a problem with the implementation below?
  2. Do I make right use of Function in Modules?
  3. Does the Function has to contain error handler as the ThisOutlookSession?

In Forms: TheEmailCharacteristicFormexists

' Characteristic : Product

Private Sub CommandButton1_Click()

  Dim Item As MailItem

  Set Item = Outlook.Application.ActiveInspector.CurrentItem

  Item.Subject = "P- " + Item.Subject

  Unload Me

End Sub

' Characteristic : Service

Private Sub CommandButton2_Click()

  Dim Item As MailItem

  Set Item = Outlook.Application.ActiveInspector.CurrentItem

  Item.Subject = "S: " + Item.Subject

  Unload Me

End Sub

' If clicks on the close button (X) of the user form, it returns back to the email.

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)

  If CloseMode = vbFormControlMenu Then

    Cancel = False

    CloseMyForm= True

  End If

End Sub

In Modules

' Global variable CloseMyForm takes the value True in case the user closes the user from the (X) button

Public CloseMyForm As Boolean

Function AddCharacteristic() As Boolean

  ' Initialize global variable closeMyForm to False every time EmailCharacteristicForm is used. Variable becomes True when form closed from (X) button.

  CloseMyForm = False

  ' Show EmailCharacteristicForm .

  EmailCharacteristicForm .Show vbModal

  ' If user closes the EmailCharacteristicForm from by clicking the (X), then should return back to the email.

  ' AddCharacteristic function returns False when userform is closed by the user and no characteristic is added.

  ‘ It returns True when the user press a button in the form to add a characteristic

  AddCharacteristic = Not CloseMsgBoxFlag

End Function

Proper Call a User form

$
0
0

Hi all,

just a quick question.  Which is best programming pactice when you call a user form (lets say from an ItemSend Event).

To call the form directly by its name: ExampleForm. Show vbModal

Or to use a variable (like below)

Dim myForm As New ExampleForm. Show

MyForm.Show vbModal

Thanks for the help

</article><//article>

How do I capture AppointmentItem events in a shared calendar?

$
0
0

My Add-In processes the events of the AppointmentItem object.

For the logged in user, everything works fine.  However, it doesn't work consistantly when dealing with a Shared Calendar

When Outlook starts I get all the shared calendars and store them in a Dictionary object (declared at class level to avoid garbage collection).

Whenever a new appointment is Added to the Shared calendar (Folder.Items.ItemAdd event) or an AppointmentItem is selected, I add it to a collection for further processing.  I use the same code that is being used for the logged in user.

The Folder events in the Shared Calendar fire consitently; no problem there.  However, the AppointmentItem events fire a few times when I make changes to the appointment ... other times they won't fire.  Then they fire again.  

I'm just not sure of what's happening.  Any ideas?

Dictionary.Clear and AppointmentItem

$
0
0

I'm using a Dictionary to store a collection of AppointmentItem wrappers.

Dictionary< string /*EntryID*/, AppointmentWrapperClass>AppointmentWrapper

From time to time I need to clear the Dictionary

MySelectionChangeHandler()

{

    if( /*  some condititon * )

    {

          AppointmentWrapper.Remove( /*EntryID Goes here*/ );

     }

}

The AppointmentItems are removed, but I don't think the associated OUtlook.Appointment item is being released.  

My guess is that the "Clear" member function doesn't call any of the classes methods to destroy the object (like a destructor, or Dispose, or something similar ).

The object is of course removed from the Dictionary collection, but it's resources are not released.  Do I have to write code myself to release it before I invoke "Clear" or does "Clear" have a mechanism to call a class' destruction methods (e.g. dispose, destructors, etc.)

Scripts for creating public folders in Outlook/Exchange 2003 no longer work for Outlook 2010

$
0
0

Here is the message and the offending code. I know there are changes since 2003, but I don't know enough about code to fix it. This is part of a script that references SQL, ColdFusion, and gosh knows what else.

The attempted
operation failed. An object could not be found

   // create public folder on exchange server
    var pfStatus_number  = 0;
    var pfMessage_string = "A public folder was successfully created in Outlook. Use it to store project correspondence sent/received via e-mail.";
    try {
        try {
            var outlook_object = new ActiveXObject("Outlook.Application");
          }
        catch(e_object) {
            throw { number:e_object.number, description:"Cannot create public folder. Unable to access Outlook. Verify the application is installed." };
          };
        var namespace_object = outlook_object.getNamespace("MAPI");
        namespace_object.logon("",
                               "",
                               false,
                               false);
        var root_object = namespace_object.folders("Public Folders").folders("All Public Folders"); // olPublicFoldersAllPublicFolders = 18
        try {
            var prjFldr_object = root_object.folders("projects");
        }
        catch (e_object) {
           throw { number:e_object.number, description:"Cannot create public folder. The projects public folder could not be found." };
        };
        var folders_array = retrievePublicFolders(project_serial_number);
        var parentFldr_object = prjFldr_object;
        var childFldr_object  = null;
        for (var j_number = 0;
             j_number < folders_array.length;
             j_number++) {
         // get folder; if error occurs, create folder
         try {
            childFldr_object = parentFldr_object.folders(folders_array[j_number]);
         }
         catch(e_object) {
            childFldr_object = parentFldr_object.folders.add(folders_array[j_number],
                                                             6); // olFolderInbox
         };
         parentFldr_object = childFldr_object;
         childFldr_object  = null;
          };
        parentFldr_object = childFldr_object;
        folders_array = null;
    }
    catch(e_object) {
        pfStatus_number  = e_object.number;
        pfMessage_string = e_object.description;
    };

Body search and auto reply email

$
0
0

I have what seems to be a complicated situation so I will try my best to explain what I want to accomplish.

Right now we recieve emails that look like this from searches@loansifter.com

You have a new search running on your consumer portal.

Time Stamp: 8/31/2010 11:25:28 AM

Visitor's IP adress:xxxxxxxxxxxxxxxxxxx

Name: JohnDoe

County: XXXXX

State: XX

Zip Code: xxxxx

Home Phone: (xxx) xxx-xxxx

Email: johndoe@comcast.net

 

What I am attempting to do is create something that will search this email for the "Email: ctullrich@comcast.net" line of text. Then place that in a created email sending to that address. Then the body of the email that we are sending is a custom email with an imbedded image. I have looked into the VB environment, macro, and rules area but I am unfamiliar with Outlook coding. Any help is appreciated!

How to change the recipient's header after IMAPISession::ShowForm is called.

$
0
0

<input role="presentation" style="opacity:0;height:1px;width:1px;z-index:-1;overflow:hidden;;" tabindex="-1" type="text" />

Hi,

I'm using extended MAPI to send a mail with attachment, just like what MAPISendMail did, but with extended MAPI's better unicode support.

Now I'm applying an workaround to avoid attachment being corrupted according to following link:
http://blogs.msdn.com/b/stephen_griffin/archive/2008/08/04/forcing-plain-text-with-mapi.aspx

It works well when I first fill in recipients info, change the recipient's header, and then show the new message window.

But when the new message window is shown first, and the user entered the recipients info by themselves manually, I could not find an opportunity to change the recipient's header. And the attachment is corrupted when the mail is sent.

How could I achieve this? Any help is appreciated.

By the way, this set of API(or something else) is making me crazy and despair.
Is there some replacement to use for sending an email, with better unicode support, attachment support and ease of use?

Viewing all 6421 articles
Browse latest View live


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