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

Can't get SMTP address from GAL entries using Extended MAPI

$
0
0

The following chain of property and method calls works as it should:

AddressEntry.GetExchangeUser().PrimarySmtpAddress

But when I try to extract it using a low-level code where I am trying to get the value of the following property:

PR_EMS_AB_PROXY_ADDRESSES

Or even with Redemption (Hello Dmitry!):

RDOAddressEntry.SMTPAddress

If the address type is "EX", Redemption tries to retrieve the PR_SMTP_ADDRESS property, if unsuccessful, it retrieves the default SMTP address from the PR_EMS_AB_PROXY_ADDRESSES Extended MAPI property.

Why does OOM work correctly and Extended MAPI (with Redemption) fail?

P.S. Logs show that even the OOM may fail to retrieve the SMTP address for GAL entries.



MapiSendMail peculiarity when Outlook is default MAPI mail device

$
0
0

I have a simple MAPI application, which uses MAPISendMail (code snippet below) to send an email with a text body and a single "To:" recipient. We would prefer NOT to display the email dialog - since it filled out in the mapiMessage structure. That means in the snippet below, we'd like to set flags = 0. When we do this and when Windows Live Mail is the default MAPI handler, there is no problem and the message is sent correctly. However, when Outlook is the default MAPI handler, and flags=0, we get a popup Information message box (from MS Outlook) that says "A program is trying to send an e-mail message on your behalf. If this is unexpected, click Deny and verify your antivirus software (ours is Norton) is up-to-date." There is an Allow and Deny (and Help) button, but even when Allow is clicked, the message is not sent. The only way to send the message that we have found works with Outlook is to use the non-zero flags setting below.

My question is how can we get this works without popping up the email dialog when Outlook is the default MAPI app?

Here is the code snippet:

FLAGS flags = MAPI_DIALOG|MAPI_LOGON_UI;

ULONGnError = lpfnMAPISendMail(NULL, 0,&mapiMessage, flags, 0);

OST file format from ol 2013

$
0
0

Could someone say what exactly changed to OST file format since Outlook 2013 ?

I have read that:
By default, when Outlook 2013 is installed, a new compressed version of the Outlook data file (.ost) is created. This new compressed version of the .ost is up to 40% smaller than the .ost files that were created by earlier versions of Outlook.

But what exactly changed in this new compressed version? We have an important product that works with not connected OST files and we are using PST.NET (by independentsoft) component which provide the functionality for getting info from not connected OST files. However OST files that are created by Outlook 2013 can't be opened because the structure is different from OST files created by older Outlook.

Deploying Outlook Add-in thru InstallShield Setup (Basic MSI) - Windows SmartScreen blocks the Setup

$
0
0

Hi

I'm trying to install an Outlook add-in using the Setup EXE (Created using InstallShield - Basic MSI). 

When i try to install this exe from the local copy it works fine.

But the same exe when i download from our website and try to install Windows SmartScreen is blocking the installation (shows Unknown Publisher)

The Core DLLs, MSI and EXE are properly signed by a CA while building the setup thru InstallShield. After downloading the EXE from the website, i checked the digital signatures and details are proper, still Windows SmartScreen blocks the installation.

Now, if i right click the Setup Exe and go to Properties -> Unblock and then if i install, i gets installed properly.

Any reason why this happens and how do we avoid it?

Thanks

Raghunathan S

Outlook 2010 - recurring appointment

$
0
0

Hello,

Why is it when i export my calendar, for any recurring events it only shows the very first start date appointment. I want it to export every occurence and the relevant date but the below code doesn't seem to do that... 

  If strLst <> "" Then strLst = Left(strLst, Len(strLst) - 2)
                    'Add a row for each field in the message you want to export
                    excWks.Cells(lngRow, 1) = olkApt.Categories
                    excWks.Cells(lngRow, 2) = olkApt.Subject
                    excWks.Cells(lngRow, 3) = Format(olkApt.Start, "dd/mm/yyyy")
                    excWks.Cells(lngRow, 4) = Format(olkApt.End, "dd/mm/yyyy")
                    excWks.Cells(lngRow, 5) = Format(olkApt.Start, "hh:nn ampm")
                    excWks.Cells(lngRow, 6) = Format(olkApt.End, "hh:nn ampm")
                    excWks.Cells(lngRow, 7) = DateDiff("n", olkApt.Start, olkApt.End) / 60
                    excWks.Cells(lngRow, 7).NumberFormat = "0.00"
                    excWks.Cells(lngRow, 8) = strLst
                    lngRow = lngRow + 1
                    lngCnt = lngCnt + 1
                End If

Cheers,

Cam

Outlook script to forward emails based on senders' address

$
0
0
Hello,

I desperately need help for this. My office inbox receives 100-200 emails daily which we have to disseminate to different groups of people in the firm. I was hoping to semi-automate this process by forwarding each incoming email based on the senders' address to the corresponding group of recipients. For example, if the senders' address contains "@oaktree.com", then this email should be forwarded to a group of people handling the Oaktree account.

Typically, if we only had a few accounts, I can upload each account one by one. However, we have 1000+ accounts to be forwarded and I cannot possibly upload them account by account. Each senders' address is also accompanied by a group of recipients and these are all recorded in an excel sheet.

Is there anyway for the script to search the senders' address in the incoming email, and then forward it to the relevant account handlers stated in the excel sheet?

Thanks so much so much in advance.

Best regards,
Project_paw

Help | reading attachment status in Compose mode

$
0
0
In read mode of email i am able to get the attachment details like length and file Name but while composing the email or editing the email i am unable to get the details of attachment for that email so please guide me to get the attachment detail while composing or editing the emails. here is the code which i have written to access the editing email.

this code item.attachments gives undefined error in compose mode or edit mode of email:- var item = Office.cast.item.toItemCompose(Office.context.mailbox.item);

this code works perfectly in read mode of email :- Office.context.mailbox.item.attachments

Force Address Download in 2010?

$
0
0

is there a way to script this? We need to have Outlook 2010 download the Address Book via script. I've googled this but have not found an answer yet.

Thanks. 


mqh7


Email body is empty for emails sent from saved .msg file in Outlook 2013

$
0
0

Hi,

Last week we've encountered a weird problem.

In a 2 day period, all of a sudden clients were calling saying that the mails they had send using our program were empty !?!

(Others were still working)

We didn't do any updates and it worked the days before so I suspect a Windows Update to be the reason.

(However, I cannot seem to find out wich one, they are almost all "security updates" ...)

After a lot of debugging, I found out that this occurs because the mails are in fact .msg files wich we've created.

(Using a .net VSTO addin)

I then started outlook in safe mode, created a new email with content and then did a manual save to a msg file using the menu.

When I opened the file I saw the content, but when i sent it to myself it was empty !?!

So it is in fact a general problem (and not a programming problem), it simply seems to be Outlook itself ! :-s

In our software, we work a lot with msg files so this is an urgent problem.

Is there someone who can help me out with this ?

Any suggestions / workarounds / fixes are welcome.

Many thanks,

Fred

Outlook 2010 - date range export

$
0
0

Hi,

I'm trying to specify a date range to export but it doesn't seem to work?

Any help is appreciated...

Sub RunExportCalendarsToExcel()
    'Change the name of the conference room on the next line.  The name must match the name of the mailbox.'
    ExportCalendarToExcel "Rutherford Cameron", True
    'Repeat the next line for each subsequent conference room.  Be sure to change the name.'
    'ExportCalendarToExcel "Fiddy Hayley"


End Sub

Sub ExportCalendarToExcel(strCalendarName As String, Optional bolClearWorksheet As Boolean)
    Dim olkFolder As Outlook.Folder, olkItems As Outlook.Items, olkAppt As Outlook.AppointmentItem, olkRecipient As Outlook.Recipient
    Dim excApp As Object, excWkb As Object, excSht As Object, excRng As Object, lngRow As Long, strDat As String, datBeg As Date, datEnd As Date, arrTmp As Variant
    Dim arrTitle As Variant

    strDat = InputBox("Enter the date range of the calendar to export in the form ""mm/dd/yyyy to mm/dd/yyyy""", SCRIPT_NAME, Date & " to " & Date)
    arrTmp = Split(strDat, "to")
    datBeg = IIf(IsDate(arrTmp(0)), arrTmp(0), Date) & " 12:00am"
    datEnd = IIf(IsDate(arrTmp(1)), arrTmp(1), Date) & " 11:59pm"

    'Launch Excel and open the spreadsheet'
    Set excApp = CreateObject("Excel.Application")
    excApp.Visible = True
    'Change the name and path of the spreadsheet on the next line'
    Set excWkb = excApp.Workbooks.Open("U:\Calendar_Export.xlsx")
    Set excSht = excWkb.Worksheets(1)
    If bolClearWorksheet Then
        Set excRng = excSht.Range("A1").CurrentRegion
        lngRow = excRng.Rows.Count
        excApp.Rows(2 & ":" & lngRow).Delete
        lngRow = 2
    Else
        lngRow = excSht.UsedRange.Rows.Count + 1
    End If

    'Connect to and process the shared calendar'
    Set olkRecipient = Session.CreateRecipient(strCalendarName)
    Set olkFolder = Session.GetSharedDefaultFolder(olkRecipient, olFolderCalendar)
    Set olkItems = olkFolder.Items.Restrict("[Start] >= '" & Format(datBeg, "ddddd h:nn AMPM") & "' AND [Start] <= '" & Format(datEnd, "ddddd h:nn AMPM") & "'")
    olkItems.Sort "[Start]"
    olkItems.IncludeRecurrences = True

    For Each olkAppt In olkItems
        arrTitle = Split(olkAppt.Subject, "-")
        excSht.Cells(lngRow, 1) = strCalendarName
        excSht.Cells(lngRow, 2) = olkAppt.Categories
        excSht.Cells(lngRow, 3) = olkAppt.Start
        excSht.Cells(lngRow, 4) = olkAppt.End
        excSht.Cells(lngRow, 5) = olkAppt.Subject
        excSht.Cells(lngRow, 6) = Format(olkAppt.Start, "hh:nn ampm")
        excSht.Cells(lngRow, 7) = Format(olkAppt.End, "hh:nn ampm")
        excSht.Cells(lngRow, 8) = DateDiff("n", olkAppt.Start, olkAppt.End) / 60
        lngRow = lngRow + 1
    Next

    excSht.Columns("A:H").AutoFit

    'Save the spreadsheet and exit Excel'
    Set excRng = Nothing
    Set excSht = Nothing
    'excWkb.Save
    Set excWkb = Nothing
    excApp.Quit
    Set excApp = Nothing

    'Clean-up the Outlook objects'
    Set olkFolder = Nothing
    Set olkItems = Nothing
    Set olkAppt = Nothing
End Sub


Exception creating word doc from Inspector.WordEditor, I suspect conflict with another add-in

$
0
0

I have an Add-in for Outlook that inserts text into the body of appointments. The add-in works great for over 50,000 people. However, it fails on every machine it is loaded on at one company. Obviously something in their environment is causing the failure. I have done a remote desktop to their system and we disabled all add-ins in Outlook and Word but still get the error.I am at a loss as to how to proceed. Any suggestions are appreciated.

They are running Outlook 2013 32 bit on Windows 7 64 bit. The exception occurs attempting to create the word doc from the Inspector.WordEditor.

The exception is:
2015-04-30 11:17:11: Message ID 0002 - Button Not Handled
System.Runtime.InteropServices.COMException (0x84104005): The operation failed.
   at Microsoft.Office.Interop.Outlook._Inspector.get_WordEditor()
   at JCSTechnologies.CollabAddin.modOutlook.HndlBtnClck(Int32 BtnIndx, Int32 InstncID, String ProfileName) in E:\Data\SourceCode\Collaboration Addin\xxxxxe\xxxxxPlugin\MAIN\modOutlook.vb:line 709
   at JCSTechnologies.CollabAddin.modOnConnect.OnRbnBtnClck(IRibbonControl Btn) in E:\Data\SourceCode\Collaboration Addin\xxxxx\xxxxPlugin\MAIN\modOnConnect.vb:line 427

'Button click event for button that adds text to an Email or Appointment body '``````` Dim MyInspctr As Outlook.Inspector = Nothing Dim MyAptmntItm As Outlook.AppointmentItem = Nothing Dim MyWordDoc As Word.Document = Nothing '````` If g_OLVrsn >= OlVrsn.OL2007 Then UsingWordMail = True ThsHndl = 0 Else '```` If TypeOf m_oApp.ActiveInspector.CurrentItem Is Outlook.AppointmentItem Then MyAptmntItm = CType(m_oApp.ActiveInspector.CurrentItem, Outlook.AppointmentItem) If UsingWordMail Then MyInspctr = MyAptmntItm.GetInspector MyWordDoc = CType(MyInspctr.WordEditor, Microsoft.Office.Interop.Word.Document) 'Exception occurs here


John Svercek

Outlook add-ins in Office 365 OWA

$
0
0

I wanted to know when there will be a way to create add-in for web version of outlook. As far as I’m understand it is possible to create addin’s that will be available in Outlook 2016/2013 application but I’m not sure when those addin’s will be available in web page? I found some roadmap but there is only information about Q1 of 2016. Are there any news for that?

VBA Set Sender Address ( or SendAs ) for NDR Resend

$
0
0

Hi All

For my Macro i need to Resend message from NDR ( Qurantine Mailbox )

I can open NDR & Execute Resend but i need to specify Sender Address ( ResendFrom) - how to do this? Message Class is IPM.Resend and there is no Sender Address or SentOnBehalfOfName.


Best Wishes, Andrew Golubenkoff

How to update VSTO Ribbon in all Forms/Windows when out of Focus

$
0
0

I have a ribbon menu who's buttons are enabled/disable given a certain criteria (external web api disconnects). This Ribbon menu is present on ReadMail,Explorer,NewMail.

I've implemented both the Ribbon XML and Ribbon Visual Designer controls to test out BOTH UIs. Obviously only one works at a time.

When the VSTO gets loaded on Outlook. Only the ACTIVE/FOCUSED window will be updated. All foreground/background windows are never updated visually. They only get updated when THAT WINDOW is in focus.

Example Visual Designer Code:

private void OutlookManager_ConnectionChanged()
{
    // Disable all buttons if OutlookManager informs not connected
    this.homeDeleteBtn.Enabled = OutlookManager.IsConnected;
    this.homeFilePrivatelyBtn.Enabled = OutlookManager.IsConnected;
    this.homeFilePublicallyBtn.Enabled = OutlookManager.IsConnected;
    this.homeRepairBtn.Enabled = OutlookManager.IsConnected;
    this.homeSyncEmailBtn.Enabled = OutlookManager.IsConnected;
}

Example RibbonXML Code:

private void OutlookManager_ConnectionChanged() { // Invalidate Ribbon to refresh the UI if (ribbon != null) { ribbon.Invalidate(); } }

// Set to the Enabled property on XML code public bool IsRibbonButtonEnabled(Office.IRibbonControl rControl) { // Disable all buttons if OutlookManager informs not connected return OutlookManager.IsConnected); }




Update or Rewrite due to technical changes from Outlook 2010 to 2013 and 2016

$
0
0

I have been task with updating or rewritting an add-on for Outlook. At present we are using Outlook 2010 we are going to Outlook 2013 and then to 2016. It there technical reasons I should rewrite the application using the latest framework?


Move Data from email to specific cells in excel table

$
0
0


I need to extract a certain part of an email and move it into a specified table in excel. Here is how the email is formatted:

Employee Information:
Name: Joe Smith
Email: jsmith@email.com
Employee ID: 012345
Cost Center: 1A23

Ordering Details:
Activity Number: 555555
Mobile Number: 5558675309

Accessories/Cost:
Accessory 1: $38.88
Quantity: 1
Accessory 2: $24.99
Quantity: 1
Accessory 3: $39.99
Quantity: 1

Business Justification: Replacement
Comments: Needed

Here is how I would like the output to look in excel:

http://i.stack.imgur.com/el9fW.png

The catch is that the Accessory name changes with each email and sometimes there is only 1 Accessory listed and sometimes up to 5. I need the code to be able to adapt depending on how many are listed.

Here is what I came up with but it is not what I need due to not copying all of the info to the rows and not adapting to how many accessories are listed. Any help is appreciated.

Sub CopyAccessoriesToExcel()
    Dim xlApp As Object
Dim xlWB As Object
Dim xlSheet As Object
Dim xl
Dim olItem As Outlook.MailItem
Dim vText As Variant
Dim sText As String
Dim vItem As Variant
Dim i As Long
Dim rCount As Long
Dim bXStarted As Boolean
Dim rTime As Date
Const strPath As String = "C:\AccessoriesTracking.xlsx" 'the path of the workbook

If Application.ActiveExplorer.Selection.Count = 0 Then
    MsgBox "No Items selected!", vbCritical, "Error"
    Exit Sub
End If
On Error Resume Next
Set xlApp = GetObject(, "Excel.Application")
If Err <> 0 Then
    Application.StatusBar = "Please wait while Excel source is opened ... "
    Set xlApp = CreateObject("Excel.Application")
    bXStarted = True
End If
On Error GoTo 0
'Open the workbook to input the data
Set xlWB = xlApp.Workbooks.Open(strPath)
Set xlSheet = xlWB.Sheets("Sheet1")
xlWB.Sheets(1).Cells.Delete

'Process each selected record
 rCount = xlSheet.UsedRange.Rows.Count
 'cCount = xlSheet.UsedRange.Columns.Count
  For Each olItem In Application.ActiveExplorer.Selection
    sText = olItem.Body
    rTime = Format(olItem.ReceivedTime, "mmmm d, yyyy")
    vText = Split(sText, Chr(13))
    'Find the next empty line of the worksheet
     rCount = rCount + 1

    'Check each line of text in the message body
    For i = UBound(vText) To 0 Step -1


        xlSheet.Range("A" & rCount).Value = rTime
        'Sets column A to Date Email was Received

        If InStr(1, vText(i), "Activity Number:") > 0 Then
            vItem = Split(vText(i), Chr(58))
            xlSheet.Range("B" & rCount) = Trim(vItem(1))
        End If

        If InStr(1, vText(i), "Name:") > 0 Then
            vItem = Split(vText(i), Chr(58))
            xlSheet.Range("C" & rCount) = Trim(vItem(1))
        End If

        If InStr(1, vText(i), "Employee ID:") > 0 Then
            vItem = Split(vText(i), Chr(58))
            xlSheet.Range("D" & rCount) = Trim(vItem(1))
        End If

         If InStr(1, vText(i), "Cost Center:") > 0 Then
            vItem = Split(vText(i), Chr(58))
            xlSheet.Range("E" & rCount) = Trim(vItem(1))
        End If

        If InStr(vText(i), "Accessories/Cost:") > 0 Then

            'ParseText = vText(i + 1) & vbCrLf
            xlSheet.Range("F" & rCount) = Trim(vText(i + 1))
            vItem = Split(vText(i + 2), Chr(58))
            xlSheet.Range("G" & rCount) = Trim(vItem(1))

            'If vText(i + 3) <> Null Then
            xlSheet.Range("F" & rCount + 1) = Trim(vText(i + 3))
            vItem = Split(vText(i + 4), Chr(58))
            xlSheet.Range("G" & rCount + 1) = Trim(vItem(1))
            'End If

        End If
    Next i
    xlWB.Save
Next olItem


Set xlApp = Nothing
Set xlWB = Nothing
Set xlSheet = Nothing
Set olItem = Nothing


End Sub





Get an event on new sent email in ol Folder Sent Mail

$
0
0

Hello,

Actually what I want to do is

foreach (Account account in Globals.ThisAddIn.Application.Session.Accounts) {              (Folder)account                  .DeliveryStore                  .GetDefaultFolder(OlDefaultFolders.olFolderSentMail)                  .Items                  .ItemAdd += SomeMethod;

But ItemAdd is never rise... What can I do?


Outlook Close during Add In Installation

$
0
0

This could be a little off topic. So I apologise if it is.

I currently use InstallShield for the user to install my add in. Is there anyway to prompt the user to close Outlook if they have it open upon installation of my add in?

ReplayToAll with some text

$
0
0

Hi guys,

I have implemented method replay to all, but I want automatically replay to all with some text.

Could you please help me. 

Open an EML and forward it?

$
0
0

Hi

How can I in and Outlook Add-in open an EML file from disk, "click forward" and show it for the user, so he can enter the forward text and send it?

My code (which doesn't work) looks like this:

Dim filename As String = "D:\email_test.eml"Dim mail As Outlook.MailItem = CType(Me.Application.CreateItemFromTemplate(filename), Outlook.MailItem) ' Doesn't workDim forwardEmail As Outlook.MailItem = mail.ForwardforwardEmail.Display()

Thanks :)

Viewing all 6421 articles
Browse latest View live


Latest Images

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