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

Screen flickers on calling Inspector.Activate()

$
0
0

Hi 

With new update for office 1808 and above screen flickers on calling Inspector.Activate()

Steps to reproduce:
Make sure you have Outlook version 1808(Build 10730.20127) or above

In VBA console execute following code:

Sub test()
ActiveInspector.Activate
End Sub

Outlook screen flickers also if window is in restored positioned it will get maximized.

Note: Keep the outlook and VBA windows side by side to see the behavior.

This issue is not present in earlier versions.

Thanks,
Abhijeet


Want to give specific date for recurrence appointment for quaterly and half yearly occurrence

$
0
0
Hello ,

I am able to create appointment recurrence for every 6 months(half yearly) pattern but i want them to occur on particular date of that month like 18 of every month. Same as we have recurrence setup in outlook 365 and same should work for lower version of office/outlook also.

I am dong this in c# which create appointment recurrence in outlook.

Code part :

Note : half yearly not allowing to set a specific date. part is commented.

switch(recurrenceType)
                {
                 case "Annually" :
                           pattern.RecurrenceType = Outlook.OlRecurrenceType.olRecursYearly;
                           pattern.MonthOfYear = pattern.PatternStartDate.Month;
                            break;
                 case "Half Yearly":
                            pattern.RecurrenceType = Outlook.OlRecurrenceType.olRecursMonthNth    ;
                            //int d = pattern.PatternStartDate.Date.Day;
                            //pattern.DayOfMonth = d;
                            pattern.Interval = 6;
                            break;
                 case "Quarterly":
                            pattern.RecurrenceType = Outlook.OlRecurrenceType.olRecursMonthNth;
                           pattern.Interval = 3;   

Need urgent help and input.

Thanks

Win 7/Outlook 2010 VB Script to Remove Certain Public Folders Previously Added with a Script

$
0
0

I used a GPO logon script to run a .vbs to add conference room calendars to both Folder List > Public Folders > Favorites AND All Public Folders, and now would like to remove conference rooms 6,7,8,9,10 while leaving the others in place in both locations.  How can I achieve this?

Const olPublicFoldersAllPublicFolders = 18
Dim olkApp, olkSes, olkFolder
Set olkApp = CreateObject("Outlook.Application.14")
Set olkSes = olkApp.GetNameSpace("MAPI")
'Change the profile name on the next line'
olkSes.Logon "Outlook"
'Change the folder name on the next line.  Repeat the next two lines for each folder you want to add.'
Set olkFolder = olkSes.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders.Item("ABC")
olkApp.Explorers.Add olkFolder, 0
olkFolder.AddToPFFavorites
Set olkFolder = olkSes.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders.Item("Conference Room 1")
olkApp.Explorers.Add olkFolder, 0
olkFolder.AddToPFFavorites
Set olkFolder = olkSes.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders.Item("Conference Room 2")
olkApp.Explorers.Add olkFolder, 0
olkFolder.AddToPFFavorites
Set olkFolder = olkSes.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders.Item("Conference Room 3")
olkApp.Explorers.Add olkFolder, 0
olkFolder.AddToPFFavorites
Set olkFolder = olkSes.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders.Item("Conference Room 4")
olkApp.Explorers.Add olkFolder, 0
olkFolder.AddToPFFavorites
Set olkFolder = olkSes.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders.Item("Conference Room 5")
olkApp.Explorers.Add olkFolder, 0
olkFolder.AddToPFFavorites
Set olkFolder = olkSes.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders.Item("Conference Room 6")
olkApp.Explorers.Add olkFolder, 0
olkFolder.AddToPFFavorites
Set olkFolder = olkSes.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders.Item("WFIP Calendar")
olkApp.Explorers.Add olkFolder, 0
olkFolder.AddToPFFavorites
Set olkFolder = olkSes.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders.Item("Conference Room 7")
olkApp.Explorers.Add olkFolder, 0
olkFolder.AddToPFFavorites
Set olkFolder = olkSes.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders.Item("Conference Room 8")
olkApp.Explorers.Add olkFolder, 0
olkFolder.AddToPFFavorites
Set olkFolder = olkSes.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders.Item("Conference Room 9")
olkApp.Explorers.Add olkFolder, 0
olkFolder.AddToPFFavorites
Set olkFolder = olkSes.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders.Item("Conference Room 10")
olkApp.Explorers.Add olkFolder, 0
olkFolder.AddToPFFavorites

'Change the folder name on the next line.  Repeat the next two lines for each folder you want to add.'

Set olkFolder = OpenOutlookFolder("Public Folders\Favorites\ABC")
AddFavoriteFolder olkFolder
Set olkFolder = OpenOutlookFolder("Public Folders\Favorites\Conference Room 1")
AddFavoriteFolder olkFolder
Set olkFolder = OpenOutlookFolder("Public Folders\Favorites\Conference Room 2")
AddFavoriteFolder olkFolder
Set olkFolder = OpenOutlookFolder("Public Folders\Favorites\Conference Room 3")
AddFavoriteFolder olkFolder
Set olkFolder = OpenOutlookFolder("Public Folders\Favorites\Conference Room 4")
AddFavoriteFolder olkFolder
Set olkFolder = OpenOutlookFolder("Public Folders\Favorites\Conference Room 5")
AddFavoriteFolder olkFolder
Set olkFolder = OpenOutlookFolder("Public Folders\Favorites\Conference Room 6")
AddFavoriteFolder olkFolder
Set olkFolder = OpenOutlookFolder("Public Folders\Favorites\WFIP Calendar")
AddFavoriteFolder olkFolder
Set olkFolder = OpenOutlookFolder("Public Folders\Favorites\Conference Room 7")
AddFavoriteFolder olkFolder
Set olkFolder = OpenOutlookFolder("Public Folders\Favorites\Conference Room 8")
AddFavoriteFolder olkFolder
Set olkFolder = OpenOutlookFolder("Public Folders\Favorites\Conference Room 9")
AddFavoriteFolder olkFolder
Set olkFolder = OpenOutlookFolder("Public Folders\Favorites\Conference Room 10")
AddFavoriteFolder olkFolder


olkSes.Logoff
Set olkApp = Nothing
Set olkSes = Nothing
Set olkFolder = Nothing
WScript.Quit

Sub AddFavoriteFolder(olkFolder)
Const olModuleMail = 0
Const olFavoriteFoldersGroup = 4
    Dim olkPane, olkModule, olkGroup
Set olkPane = olkApp.ActiveExplorer.NavigationPane
Set olkModule = olkPane.Modules.GetNavigationModule(olModuleMail)
Set olkGroup = olkModule.NavigationGroups.GetDefaultNavigationGroup(olFavoriteFoldersGroup)

'olkGroup.NavigationFolders.Add olkFolder

Set olkPane = Nothing
Set olkModule = Nothing
Set olkGroup = Nothing
End Sub

Function OpenOutlookFolder(strFolderPath)
' Purpose: Opens an Outlook folder from a folder path.'
Dim arrFolders, varFolder, bolBeyondRoot
On Error Resume Next
If strFolderPath = "" Then
    Set OpenOutlookFolder = Nothing
Else
    Do While Left(strFolderPath, 1) = "\"
        strFolderPath = Right(strFolderPath, Len(strFolderPath) - 1)
    Loop
    arrFolders = Split(strFolderPath, "\")
    For Each varFolder In arrFolders
        Select Case bolBeyondRoot
            Case False
                Set OpenOutlookFolder = olkSes.Folders(varFolder)
                bolBeyondRoot = True
            Case True
                Set OpenOutlookFolder = OpenOutlookFolder.Folders(varFolder)
        End Select
        If Err.Number <> 0 Then
            Set OpenOutlookFolder = Nothing
            Exit For
        End If
    Next
End If
On Error GoTo 0
End Function
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'Outlook.exe'")
For Each objProcess in colProcessList
   Set objOutlook = CreateObject("Outlook.Application")
   objOutlook.Quit
Next

Getting store ID (IOlkAccount) not present after first startup of Outlook - after account is added

$
0
0

Hi All,

The scenario happens ONLY during the first time Outlook is started after a  new mailbox is added. All starts of Outlook after the initial start do not exhibit the issue. So the first start after the account/mailbox is added to Outlook is where the issue is.

With the add-in,  we want to identify the account when a user selects a mail item in the inbox. We are able to retreive the store ID from MailFolder during the selection event. This process works every time. 

However, retrieving the store ID using the account manager does not work. But strangely, Outlook spy does show the correct value within the account manager. So obviously, Outlook Spy must be aquiring the store ID differently than I am.

My question, is there another way to retreive the IOlkAccount interface and query the store ID (PROP_ACCT_DELIVERY_STORE >>> PR_IPM_ID (0x00180102)). 

I must be able to match the folder to the account every time with out fail, and it appears that the IOlkAccount is unreliable.

Here is a code snippet.

// W O R K S all the time !!!!! // Works on fodler selection event CComPtr<Outlook::MAPIFolder> spFolder = NULL; m_spExplorer->get_CurrentFolder(&spFolder); BSTR bstrStoreId = nullptr; spFolder->get_StoreID(&bstrStoreId); if (bstrStoreId) { std::wstring wsStoreId(bstrStoreId, ::SysStringLen(bstrStoreId)); } // F A I L S first start!!!! // Called on addin startup event (STDMETHOD(OnStartupComplete)(SAFEARRAY **custom)) // Get the accounts interface and get all accounts. // ... std::wstring wsStoreId; CComPtr<Outlook::_Accounts> spAccts; HRESULT hr = spNamespace->get_Accounts(&spAccts); if (SUCCEEDED(hr) && spAccts) { long lCount = 0L; spAccts->get_Count(&lCount); for (long l = 1L; l <= lCount; l++) { CComPtr<Outlook::_Account> spAcct; hr = spAccts->Item(_variant_t(l), &spAcct); if (SUCCEEDED(hr) && spAcct) { CAccount acct; CComPtr<Outlook::_Store> spDeliveryStore; hr = spAcct->get_DeliveryStore(&spDeliveryStore);

// Returns 0x800C8101 first run after account installed

if (SUCCEEDED(hr) && spDeliveryStore) // Fails to return the store interface { BSTR bstrStoreId = nullptr; spDeliveryStore->get_StoreID(&bstrStoreId); acct.m_wsFolderDeliveryEntryID = GetStringFromBSTR(bstrStoreId); BSTR bstrDisplayName = nullptr; spDeliveryStore->get_DisplayName(&bstrDisplayName); wsStoreId = GetStringFromBSTR(bstrDisplayName); } else { CComPtr<IUnknown> spUnk; spAcct->get_IOlkAccount(&spUnk); if (spUnk) { IOlkAccount* lpAccount = nullptr; hr = spUnk->QueryInterface(IID_IOlkAccount, reinterpret_cast<LPVOID*>(&lpAccount)); if (SUCCEEDED(hr) && lpAccount) { // Get the store entry ID ACCT_VARIANT pProperty = { NULL }; hr = lpAccount->GetProp(PR_IPM_ID, &pProperty);

// THE value returned on first startup is E_ACCT_NOT_FOUND (0x800C8101)

if (SUCCEEDED(hr) && pProperty.dwType == PT_BINARY && pProperty.Val.dw > 0) // FAILS { wsStoreId = ToHex((LPBYTE)pProperty.Val.bin.pb, pProperty.Val.dw); } lpAccount->Release(); } } } } } }

Any suggestions would be greatly appreciated.

Thanks,

Tom


Automatically saving emails as msg files?

$
0
0

I hope someone will be able to help. I am trying to automatically save emails as.msg files. These emails are requests that are sent by the public via an online portal. The emails will then have an index file created relating to it and then uploaded into an EDM system. I need to save the email in its original format. I have done something similar before but saving attachments rather than the actual email.

I had a number of attempts and the script below is the closest I have got but this is searching through “my” default email address and I need it to read though a different one, possibly a number of different ones. Does anyone know if this can be modified to parameterise an email address to search though?

$DestinationPath = "c:\Support\files\"
$EmailAddress = "Application.Emails@donny.gov.uk"

#Removes invalid Characters for file names from a string input and outputs the clean string
Function Remove-InvalidFileNameChars 
{
    param
    (
        [Parameter(Mandatory=$true, Position=0)]
        [String]$Name
    )
    return [RegEx]::Replace($Name, "[{0}]" -f ([RegEx]::Escape([String] [System.IO.Path]::GetInvalidFileNameChars())), '-')
}

#Add Interop Assembly
Add-type -AssemblyName "Microsoft.Office.Interop.Outlook" | Out-Null

#Type declaration for Outlook Enumerations
$olFolders = "Microsoft.Office.Interop.Outlook.olDefaultFolders" -as [type]
$olSaveType = "Microsoft.Office.Interop.Outlook.OlSaveAsType" -as [type]
$olClass = "Microsoft.Office.Interop.Outlook.OlObjectClass" -as [type]

#Add Outlook Com Object, MAPI namespace, and set folder to the Inbox
$outlook = New-Object -ComObject Outlook.Application
$namespace = $outlook.GetNameSpace("MAPI")

#
$folder = $namespace.getDefaultFolder($olFolders::olFolderDrafts)
#$folder = $namespace.getDefaultFolder($olFolders::olFolderDrafts)

#Iterate through each object in the chosen folder
foreach ($email in $folder.Items) 
{

    #Get email's subject and date
    [string]$subject = $email.Subject
    [string]$sentOn = $email.SentOn

    #Strip subject and date of illegal characters, add .msg extension, and combine
    $fileName = Remove-InvalidFileNameChars -Name ($sentOn + "-" + $subject + ".msg")

    #Combine destination path with stripped file name
    $dest = $DestinationPath + $fileName

     $email.SaveAs($dest, $olSaveType::olMSG)   
}


Set Alias Name for Sender in the email sent using ole object in the application code

$
0
0
Currently we have an application which uses Lotus Notes to send out emails automaticall based on some conditions. 
We use the below property to set the Sender Name as "Application Name" instead of the user session from which it is sent. 

ole_object.From       = 'Application Name'

Now we are migrating to Microsoft outlook. But while remediating the application, we could'nt figure out a property that can be used to set the Sender name as 'Application Name'. Rather it is fetching the actual Microsoft Outlook address. 

Will the above feature work in Outlook? 

Tracking flag on VBA - email properties

$
0
0

Hi

Im getting the list of emails on Excel from outlook and the VBA Code looks great. But, I would like to include into the code if the conversation are controlled (Track button - CRM). See image below:

Example of mail properties on outlook message

Do you know which mail properties I need to use to get the tracking information of the conversations?

Library: docs.microsoft.com/.../microsoft.office.interop.outlook.mailitem;view=outlook-pia#properties_

The code that I am running

Sub Emails_Outlook()
'Carregar e-mails do outlook para o excel
Dim appOutlook As Object
Dim olNS As Object
Dim olFolder As Object
Dim olItem As Object
Dim r As Long
Dim Ws As Worksheet
Dim LstObj As ListObject
Dim rngDB As Range, n As Integer

On Error Resume Next
Set appOutlook = GetObject(, "Outlook.Application")
If appOutlook Is Nothing Then
Set appOutlook = CreateObject("Outlook.Application")
End If
On Error GoTo 0
Set olNS = appOutlook.GetNamespace("MAPI")
'Abaixo preencha o nome do arquivo de dados PST e a pasta.
'Neste caso o arquivo é Douglas Godoy e a pasta Caixa de Entrada.
Set olFolder = olNS.Folders("vaz.felipe@outlook.com.br").Folders("Caixa de Entrada").Folders("Teste")
Cells.Delete
r = 3
'Cria um array montando o título das colunas no arquivo.
Range("A3:E3") = Array("Título", "Quem enviou", "Nome de quem enviou", "Para","Data e Hora")
For Each olItem In olFolder.Items
If TypeName(olItem) = "MailItem" Then
r = r + 1
Cells(r, "A") = olItem.Subject 'Assunto do e-mail
Cells(r, "B") = olItem.SenderEmailAddress 'E-mail do remetente
Cells(r, "C") = olItem.Sender 'Nome do remetente
Cells(r, "D") = olItem.To 'E-mail do destinatário
Cells(r, "E") = olItem.ReceivedTime 'Data/Hora de recebimento

'Cells(r, "E") = olItem.Attachments.Count 'Número de anexos
'Cells(r, "F") = olItem.Size 'Tamanho da mensagem em bytes
'Cells(r, "G") = olMail.LastModificationTime 'Última modificação
'Cells(r, "H") = olMail.Categories 'Categoria
'Cells(r, "I") = olMail.SenderName 'Nome do remetente
'Cells(r, "J") = olMail.FlagRequest 'Acompanhamento
'Cells(r, "K") = olItem.Body 'Tome cuidado ao utilizar pois carrega os dados do corpo do email
Application.StatusBar = r
End If
Next olItem

For Each Ws In Worksheets
With Ws
Set rngDB = .Range("a3").CurrentRegion
For Each LstObj In Ws.ListObjects
LstObj.Unlist
Next
If WorksheetFunction.CountA(rngDB) > 0 Then
n = n + 1
Set LstObj = .ListObjects.Add(xlSrcRange, rngDB, , xlYes)
With LstObj

.Name = "AtendimentoPresencial" '& n
.TableStyle = "TableStyleLight8"
End With
End If
End With
Next Ws

Columns.AutoFit
End Sub

MailItem.save exception

$
0
0

Hi,

I have issue when calling save method in MailItem object. Its throw 0x80004005 exception, "The operation failed.". I need to save this MailItem to continue. May I know what is the cause of the issue and how can I workaround with it.

Below is the client details:

Windows platform: windows 7 32-bit

Outlook platform: Outlook 2010 32-bit (online mode)

Mail server: Exchange server 2010



Outlook Calendar API

$
0
0

Hello!

I'm using the Calendar API to intergrate Outlook Events with my App. I need to share the Data Extensions (or Single Value Extended Property) with the Attendees added to an Event. Is that possible? 

outlook-SMTP Mail issue

$
0
0

Hello,

I am sending mail using SMTP and Mail sending works fine, but

Issues what I am facing

  1. Mail are visible under Inbox if I use mail id of gmail/Hotmail
  2. When I check mail in outlook 365, mails shows under outbox folder not under Inbox folder, I need received mails under Indox folder

 Code written

 

string fromEmail = Convert.ToString(dtEmailSettings.Rows[0]["Email"]);

                       string pwd = Convert.ToString(dtEmailSettings.Rows[0]["Password"]);

                       string fromPWD = DecryptPassword(pwd);

                       string smtpServer = Convert.ToString(dtEmailSettings.Rows[0]["OutgoingMailServer"]);

                       int smtpPort = Convert.ToInt32(dtEmailSettings.Rows[0]["OutgoingServerPortNumber"]);

                       MailAddress fromAddress = new MailAddress(fromEmail);

                       System.Net.NetworkCredential basicAuthenticationInfo = new System.Net.NetworkCredential(fromEmail, fromPWD);

                       smtpClient.Host = smtpServer;

                       smtpClient.Port = smtpPort;

                       message.From = fromAddress;

                       message.To.Add(emailAddress);

                       message.Subject = mailSubject;

                       message.IsBodyHtml = true;

                       //smtpClient.EnableSsl = true;

                       message.Body = mailMessage;

                       for (int i = 0; i < dtAttachement.Rows.Count; i++)

                       {

                           string strFile = dtAttachement.Rows[i].ItemArray[0].ToString();

                           

                           message.Attachments.Add(new Attachment(strFile));

                       }

                       smtpClient.UseDefaultCredentials = false;

                       smtpClient.Credentials = basicAuthenticationInfo;

                       smtpClient.Send(message);

Thanks

Does Outlook Unload Misbehaving Addins?

$
0
0
QUESTION
Does Outlook create the key HKCU\SOFTWARE\Microsoft\Office\Outlook\Addins\<addin name> and set the LoadBehavior to 0 if that Add-in misbehaves in some fashion (e.g. throws an unhandled exception)?

Our installer creates the Addin under HKLM, not HKCU.  



====================== MORE DETAILS IF NEEDED ============================
OUR CONFIGURATION

We are running 32-Bit Office on 64-Bit Windows

We use the Per-machine installation option.  Therefore the Add-In is located under
HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\Outlook\Addins\<Addin-Name>

The LoadBehavior is set to 3.

PROBLEM DETAIL:
On occasion we encounter a situation where the Add-In is unloaded.  The Add-In is listed as "Inactive" and it is unchecked in the "COM Add-Ins" dialog.  It shows the LoadBehavior state as being "Unloaded".

When we place a check in the box, the Add-In loads just fine, but no matter how many times we do this the Add-in will no longer load when we start outlook.

OBSERVATION:
The registry setting under HKLM still has the load behavior set to 3.  However, the LoadBehavior setting under HKCU\SOFTWARE\Microsoft\Office\Outlook\Addins\<addin Name> is 0.  Once I reset it back o 3 everything was fine.




Germán Hayles

outlook Addin disables at startup and when i change the name it works fine

$
0
0

Visual Studio 2017

.Net 4.0

WinForms outlook add in project  vsto.

while debugging it works fine. After a couple of times the add in remains always disabled whatever I do. (restart VS, restart outlook, restart computer). When I change the application name then it works fine. Again then after a couple of debugs happens the same and the solution is only to change the name of the assembly to a new different name.

I go to registry and delete every entry or value with that name but the problem remains.

How can I resolve this?


Running 32-Bit Outlook on 64-Bit Windows (VSTO Addin)

$
0
0
According to Microsoft when you're running 32-Bit Office on 64-Bit windows you should make two registry entries:
(We're running 32-Bit Outlook on 64-Bit Windows  .... Per Machine installation)

HKLM\SOFTWARE\Microsoft\Office\Outlook\Addins\<addin name>
HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\Outlook\Addins\<addin name>


From which Hive does 32-Bit Outlook get it's default information?  Does it use the 32-Bit Entry, or the 64-Bit Entry?


Germán Hayles

Problem Viewing Newsletter in Outlook

$
0
0
Hello Miss, Sir,

My company has problems with our campaign (Newsletter) in Outlook (office 365) on Windows 10. The chips are not displayed. However, they are displayed in other email (Zimbra, Gmail, Hotmail, Outlook Webmail, Outlook for Android).

I tried to search on Google but I did not find anything.

Thank you in advance for your return.

Have a good day


Natalia

Combining Two VBA Script in Outlook

$
0
0

I have two outlook VBA codes which I want to run whenever i received and send any mail.

I am not able to combine both, will anyone help me regarding this?

Public WithEvents objMails As Outlook.Items


Private Sub Application_Startup()
    Set objMails = Outlook.Application.Session.GetDefaultFolder(olFolderInbox).Folders("Test").Items
End Sub

Private Sub objMails_ItemAdd(ByVal Item As Object)
    Dim objMail As Outlook.MailItem
    Dim strExcelFile As String
    Dim objExcelApp As Excel.Application
    Dim objExcelWorkBook As Excel.Workbook
    Dim objExcelWorkSheet As Excel.Worksheet
    Dim nNextEmptyRow As Integer
    Dim strColumnB As String
    Dim strColumnC As String
    Dim strColumnD As String
    Dim strColumnE As String

    If Item.Class = olMail Then
       Set objMail = Item
    End If
 
    'Specify the Excel file which you want to auto export the email list
    'You can change it as per your case
    strExcelFile = "E:\Email\Email Statistics.xlsx"
    'Get Access to the Excel file
    On Error Resume Next
    Set objExcelApp = GetObject(, "Excel.Application")
    If Error <> 0 Then
       Set objExcelApp = CreateObject("Excel.Application")
    End If
    Set objExcelWorkBook = objExcelApp.Workbooks.Open(strExcelFile)
    Set objExcelWorkSheet = objExcelWorkBook.Sheets("Sheet1")
    'Get the next empty row in the Excel worksheet
    nNextEmptyRow = objExcelWorkSheet.Range("B" & objExcelWorkSheet.Rows.Count).End(xlUp).Row + 1
    'Specify the corresponding values in the different columns
    strColumnB = objMail.SenderName
    'strColumnC = objMail.SenderEmailAddress
    strColumnD = objMail.Subject
    strColumnE = objMail.ReceivedTime
    'Add the vaules into the columns
    objExcelWorkSheet.Range("A" & nNextEmptyRow) = nNextEmptyRow - 1
    objExcelWorkSheet.Range("B" & nNextEmptyRow) = strColumnB
    'objExcelWorkSheet.Range("C" & nNextEmptyRow) = strColumnC
    objExcelWorkSheet.Range("D" & nNextEmptyRow) = strColumnD
    objExcelWorkSheet.Range("E" & nNextEmptyRow) = strColumnE
    'Fit the columns from A to E
    'objExcelWorkSheet.Columns("A:E").AutoFit
    'Save the changes and close the Excel file
     objExcelWorkBook.Close SaveChanges:=True
End Sub

Public WithEvents objMails As Outlook.Items

Private Sub Application_Startup()
    Set objMails = Outlook.Application.Session.GetDefaultFolder(olFolderSentItems).Folders("CC Completed").Items
End Sub

Private Sub objMails_ItemAdd(ByVal Item As Object)
    Dim objMail As Outlook.MailItem
    Dim strExcelFile As String
    Dim objExcelApp As Excel.Application
    Dim objExcelWorkBook As Excel.Workbook
    Dim objExcelWorkSheet As Excel.Worksheet
    Dim nNextEmptyRow As Integer
    Dim strColumnK As String
    Dim strColumnL As String
    Dim strColumnM As String
    Dim strColumnN As String

    If Item.Class = olMail Then
       Set objMail = Item
    End If
 
    'Specify the Excel file which you want to auto export the email list
    'You can change it as per your case
    strExcelFile = "C:\Users\Gyan.Mohan\Desktop\Test.xlsx"
    'Get Access to the Excel file
    On Error Resume Next
    Set objExcelApp = GetObject(, "Excel.Application")
    If Error <> 0 Then
       Set objExcelApp = CreateObject("Excel.Application")
    End If
    Set objExcelWorkBook = objExcelApp.Workbooks.Open(strExcelFile)
    Set objExcelWorkSheet = objExcelWorkBook.Sheets("Sheet1")
    'Get the next empty row in the Excel worksheet
    nNextEmptyRow = objExcelWorkSheet.Range("K" & objExcelWorkSheet.Rows.Count).End(xlUp).Row + 1
    'Specify the corresponding values in the different columns
    strColumnK = objMail.SenderName
    'strColumnL = objMail.SenderEmailAddress
    strColumnM = objMail.Subject
    strColumnN = objMail.ReceivedTime
    'Add the vaules into the columns
    objExcelWorkSheet.Range("J" & nNextEmptyRow) = nNextEmptyRow - 1
    objExcelWorkSheet.Range("K" & nNextEmptyRow) = strColumnK
    objExcelWorkSheet.Range("L" & nNextEmptyRow) = strColumnL
    objExcelWorkSheet.Range("M" & nNextEmptyRow) = strColumnM
    objExcelWorkSheet.Range("N" & nNextEmptyRow) = strColumnN
    'Fit the columns from A to E
    'objExcelWorkSheet.Columns("A:E").AutoFit
    'Save the changes and close the Excel file
    objExcelWorkBook.Close SaveChanges:=True
End Sub


Office.context.mailbox.addHandlerAsync fails when reload the frame

$
0
0

I am implementing the pinnable taskpane in my outlook web add-in This is my code:

Office.initialize = function (reason) {
    $(document).ready(function () {
        // Listen to ItemChanged event
        Office.context.mailbox.addHandlerAsync(Office.EventType.ItemChanged, itemChanged, function (result) {
            console.log(result)
            if (result.status === Office.AsyncResultStatus.Failed) {
                // here will be hit if I do a postback in the server, could also be replicated by choosing "reload frame" in the right click menu
             {name: "Internal Error", message: "An internal error has occurred.", code: 5001}
            }
        });
        gatherMailItemInfo();
    });
}

Everything works fine( gatherMailItemInfo get calls when I switching between items. But as long as a do a post to the server ( can simply replicated by choosing "reload frame" in the right click menu) the handler will fail.


Outlook Add-in

$
0
0
I want to know how can I embed a web page in a custom task pane created through Outlook VSTO add-in. I have to integrate my enterprise application with Outlook.So is there any way available so that I can display the interface of my application inside that task pane?  

Bug on Executing an Outlook Rule

$
0
0

Hi,

When I am creating a rule having from:some email id.
The rule is not executing.

Outlook Add-in Menu Stay Open on Click

$
0
0

Hi,

I am developing an add-in for Outlook (VSTO). This add-in features a new ribbon split button which contains a menu (configured via CustomUI XML). This menu contains multiple checkboxes. I want to be able to open this menu, click on multiple checkboxes, and then close the menu. Problem is that clicking any checkbox always closes the menu, which means I have to open the menu multiple times to check all required checkboxes. I want to be able to click these checkboxes and keep the menu open, until I click away or click on the menu button itself. Is this in any way possible? Image Link & Reduced XML Code below:

<?xml version="1.0" encoding="UTF-8"?><customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load"><ribbon><tabs><tab idMso="TabNewMailMessage"><group id="Group" insertBeforeQ="GroupSend" autoScale="true" label="label"><splitButton id="SplitButton1" size="large" ><toggleButton id="toggleId"
              label="MyLabel"
              getImage="GetImage"
              onAction="myActionCallback"
              getPressed="getPressedCallback" /><menu id="MyMenu1" label="labelMenu" itemSize="normal" showLabel="true"><checkBox id="Checkbox1"
                    label="checkbox 1"
                    getPressed="Checkbox1GetPressedCallback"
                    onAction="myAction1" /><checkBox id="Checkbox2"
                    label="checkbox 2"
                    getPressed="Checkbox2GetPressedCallback"
                    onAction="myAction2" /></menu></splitButton></group></tab></tabs></ribbon></customUI>

Thanks!

How can I embed a web page in a custom task pane using VSTO?

$
0
0
I want to know how can I embed a web page in a custom task pane created through Outlook VSTO add-in. I have to integrate my enterprise application with Outlook.So is there any way available so that I can display the interface of my application inside that task pane?  
Viewing all 6421 articles
Browse latest View live


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