outlook-2007 interview questions
Top outlook-2007 frequently asked interview questions
I have an Outlook 2007 add-in that is trying to import ics files into Outlook.AppointmentItem objects so that I can read attributes about certain appointments. Currently I am not able to read the ics back into memory. Any suggestions on what I am doing wrong.
Outlook.Application app = new Outlook.Application();
var item = app.Session.OpenSharedItem("C:\\meeting.ics") as Outlook.AppointmentItem;
string meetingBody = item.Body; //<--*my item is null*
Thanks
Source: (StackOverflow)
As a programmer at a big corporation, I frequently send Outlook emails that contain code samples.
I'll actually type code directly into an email. This inevitably causes problems, as Outlook really likes to format text in pleasing but unhelpful ways. My code needs to be copyable out of the email and directly into code, so I don't want Outlook to mess with it by adding special characters or whatnot.
So I always need to tweak options like:
- Don't capitalize first letter of every sentence (else all my functions be Public instead of public)
- Disable smart quotes (fancy quotes don't copy+paste out of emails well)
- Never use spell checker (because it just gets annoying)
I also like my code to be in a monospaced font, black, indented, and smaller than other text. I've tried to make a Style for this, but for some reason the Style never saves. :-( [edit: turns out I wasn't telling it to work on "new documents based on this template"]
Is there some way to put code in <pre> blocks or something that tells Outlook to ignore all these rules and format code the way I want it to? If not, what ways have you found to send code snippets in Outlook emails without it getting super annoying?
Source: (StackOverflow)
I use MS Office Outlook 2007, and sometimes it converts email address as "FirstName LastName". When double click, it opens Contact form, but nowhere email address to copy into clipboard.
How is it possible to copy to clipboard email address if it uses contact?
Thanks!
Source: (StackOverflow)
I am using c# to write an Outlook 2007 add-in to store emails in a SQL Server 2005 database. I would like to be able to store the entire .msg file in a varbinary(MAX)
field. Is there a way to do this without having to use the Outlook MailItem
's SaveAs()
method to save to a temp file and then read the file back in? I will need to transfer a large number of emails to the database and would prefer to avoid costly disk reads and writes.
Source: (StackOverflow)
I'm trying to make a program that would open new Outlook 2007 message.
I've referenced from COM tab Microsoft Outlook 12.0 ObjectLibrary.
These items showed up in references in VS:
Microsoft.Office.Core
Microsoft.Office.Inerop.Outlook
Now I try to invoke following code:
var _outlookInstance = new Microsoft.Office.Interop.Outlook.Application();
var _message = (OutlookApp.MailItem)_outlookInstance.CreateItem(OutlookApp.OlItemType.olMailItem);
where OutlookApp==Microsoft.Office.Interop.Outlook namespace.
While invoking second line of listing I keep getting this exception: (InvalidCastException)
Unable to cast COM object of type
'Microsoft.Office.Interop.Outlook.ApplicationClass'
to interface type
'Microsoft.Office.Interop.Outlook._Application'.
This operation failed because the
QueryInterface call on the COM
component for the interface with IID
'{00063001-0000-0000-C000-000000000046}'
failed due to the following error:
Library unregistered.
(Exception from HRESULT: 0x8002801D
(TYPE_E_LIBNOTREGISTERED)).
That code worked well for Outlook 2003 on my other station.
I'll be grateful for any ideas how to solve it.
Source: (StackOverflow)
I have written an automated test that runs each night, and I would like to email the results each night once the test is finished.
In order to do this I attempted to put the following at the end of my batchfile:
Set MyApp = CreateObject("Outlook.Application")
Set MyItem = MyApp.CreateItem(0)
With MyItem
.To = "a@a.com"
.Subject = "Subject"
.ReadReceiptRequested = False
.HTMLBody = "resport"
End With
MyItem.Send
However, this is causing the email to not send because my Outlook is not open, as the test is run in the background, and I have no access to the UI.
Is there anyway to send this email without actually running outlook on the machine.
Thanks!
Source: (StackOverflow)
in my outlook addin I want to add a button on the Ribbon so when user click this button I want to retrieve the current selected email's body , I have this code but it retrieve only the first email from the inbox because the index is 1 :
Microsoft.Office.Interop.Outlook.Application myApp = new Microsoft.Office.Interop.Outlook.Application();
Microsoft.Office.Interop.Outlook.NameSpace mapiNameSpace = myApp.GetNamespace("MAPI");
Microsoft.Office.Interop.Outlook.MAPIFolder myInbox = mapiNameSpace.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox);
String body = ((Microsoft.Office.Interop.Outlook.MailItem)myInbox.Items[1]).Body;
so how to retrieve the current opened email in outlook? , this method work for me but I need to get the index for the current email.
Thanks.
Source: (StackOverflow)
I schedule meetings with 3-4 "busy" people. Using the Scheduling Assistant for retrieving and updating available times can be tedious.
I am trying to create an Excel macro (with Outlook open) to view available times based on the email addresses provided.
This macro creates a meeting if date is known (done). If date is not known I need to print the dates everyone is free onto the spreadsheet.
All of the users are on the same server.
Sub GetFreeBusyInfo ()
is where I need help.
1. It can print individual availability - but I need the free/busy info for the entire group
2. How do I get the results to show in a "07/01/2013 3:00 - 4:00 PM EST" format?
Option Explicit
Sub CheckAvail()
Dim myOutlook As Object
Dim myMeet As Object
Dim i As Long
'Create the Outlook Session
Set myOutlook = CreateObject("Outlook.Application")
'Create the AppointmentItem
Set myMeet = myOutlook.CreateItem(1)
myMeet.MeetingStatus = 1
i = 23
'Start at row 23
If Cells(i, 11) <> "" Then
'Add Recipients
Do Until Trim(Cells(i, 10).Value) = ""
'Add all recipients
myMeet.Recipients.Add Cells(i, 10)
i = i + 1
Loop
i = 23
myMeet.Start = Cells(i, 11).Value
'Set the appointment properties
myMeet.Subject = Cells(i, 12).Value
myMeet.Location = Cells(i, 13).Value
myMeet.Duration = Cells(i, 14).Value
myMeet.ReminderMinutesBeforeStart = 88
myMeet.BusyStatus = 2
myMeet.Body = Cells(i, 15).Value
myMeet.Save
myMeet.Display
Else
Call GetFreeBusyInfo
End If
End Sub
Public Sub GetFreeBusyInfo()
Dim myOutlook As Object
Dim myMeet As Object
Dim myNameSpace As Object
Dim myRecipient As Object
Dim myFBInfo As String, k As Long, j As Long, i As Long
'Create the Outlook Session
Set myOutlook = CreateObject("Outlook.Application")
Set myMeet = myOutlook.CreateItem(1)
myMeet.MeetingStatus = 1
i = 23
Do Until Trim(Cells(i, 10).Value) = ""
'Add all recipients
myMeet.Recipients.Add Cells(i, 10)
i = i + 1
Loop
Set myNameSpace = myOutlook.GetNamespace("MAPI")
k = 1
i = 23
Do Until Trim(Cells(i, 10).Value) = ""
k = k + 1
Set myRecipient = myNameSpace.CreateRecipient(Cells(i, 10).Value)
On Error GoTo ErrorHandler
j = 2
Cells(k, j) = Cells(i, 10).Value
Do Until Trim(Cells(i, 10).Value) = ""
myFBInfo = myRecipient.FreeBusy(#7/1/2013#, 60)
j = j + 1
Cells(k, j) = myFBInfo
i = i + 1
Loop
Loop
myMeet.Close
ErrorHandler:
MsgBox "Cannot access the information. "
End Sub
Source: (StackOverflow)
I have a .dotm template file on a network share. There are macros with references to the Word, Office, and Outlook object libraries. We use two different platforms, Windows XP and Windows 7, along with Microsoft Office 2007 and Office 2010. When users open the template file the references for Word and Office adjust automatic and accordingly (that is, they’re set to Microsoft Word 12 Object Library or Microsoft Word 14 Object Library as needed), and the macros run without a problem.
Microsoft Outlook Object Library switches properly from version 12 to 14. It does not switch properly from version 14 to 12. In that case, it gives the error that the libary is not found. Is this a bug? Is there a workaround? Something I’m overlooking?
Source: (StackOverflow)
I am new to VSTO programming. I have created a basic addin for Outlook 2007 that monitors a folder containing XML text files which it opens and then sends them as an email, then deletes them. this all works fine.
I want the user to be able to configure certain settings for the way the addin/program will operate, such as the folder that it will monitor, and other things. The logical way to do this is to create a menu item in the addin (which I have also done) that opens a windows form (or XAML window) that allows them to enter the parameters.
In my addin I added a new item Windows Form, which worked, and the designer opened. However, in my addin code I cannot open the form. The Show() method normally associated with form objects is not available.
Is this simply something you cannot do, or am I just doing it the wrong way?
I have read about Outlook form regions, but these seemed to be attached to outlook items such as a new email, task, appointment etc... there doesnt seem to be a way to create a form region that can be opened in the main window of Outlook.
Ideally, I would like to go with my original method of opening a new window from a menu item, but if this isnt possible I would like to hear other solutions.
Thanks,
Will.
Source: (StackOverflow)
For any given window I handle, I need a way to find out whether or not the given window is Modal.
Far as I can tell, there are no methods that do exactly that, which is why I need some clever workaround to work this out!
Help is appreciated!
EDIT : Why is my GetWindow(,GW_OWNER) failing? :(
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
internal static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll", SetLastError = true)]
internal static extern IntPtr GetWindow(IntPtr hWnd, GetWindow_Cmd uCmd);
[DllImport("user32.dll", ExactSpelling = true)]
internal static extern IntPtr GetAncestor(IntPtr hwnd, GetAncestor_Flags gaFlags);
[DllImport("user32.dll", SetLastError = false)]
internal static extern IntPtr GetDesktopWindow();
[DllImport("user32.dll", SetLastError = true)]
internal static extern int GetWindowLong(IntPtr hWnd, int nIndex);
const UInt32 WS_DISABLED = 0x8000000;
internal enum GetAncestor_Flags
{
GetParent = 1,
GetRoot = 2,
GetRootOwner = 3
}
internal enum GetWindow_Cmd : uint
{
GW_HWNDFIRST = 0,
GW_HWNDLAST = 1,
GW_HWNDNEXT = 2,
GW_HWNDPREV = 3,
GW_OWNER = 4,
GW_CHILD = 5,
GW_ENABLEDPOPUP = 6
}
IntPtr _inspHwnd = FindWindow("rctrl_renwnd32", inspector.Caption); // searching for a window with this name
if (_inspHwnd.ToInt32() != 0) // found window with this name
{
IntPtr _ownerHwnd = GetWindow(_inspHwnd, GetWindow_Cmd.GW_OWNER);
if (_ownerHwnd.ToInt32() != 0)
{
IntPtr _ancestorHwnd = GetAncestor(_ownerHwnd, GetAncestor_Flags.GetParent);
if (_ancestorHwnd == GetDesktopWindow())
{
if (GetWindowLong(_ancestorHwnd, -16) == WS_DISABLED)
{
// inspector is probably modal if you got all the way here
MessageBox.Show("modal flag tripped");
}
}
}
}
Source: (StackOverflow)
Our java application generates ICalendar files using ical4j, and sends them out to users as part of an HTML e-mail notification. A couple of users (the Organizers of the meeting) report that the the "Accept", "Reject", etc. buttons for the meeting are grayed out, and unclickable. The meeting is not added to the Organizer's calendar.
How can I force the meeting to be added for the Organizer?
I configured the server temporarily to send the .ics file as an attachment (instead of inline), so that I could run it through a web-based ICalendar validator. The validator gave me a warning that the Version property was supposed to be the first property, but didn't find any other problems.
The ICalendar works normally for every user except the organizer.
I was able to reproduce the issue on my own Outlook account. I noticed that if I send the meeting notice through a gmail mail server, it works normally; but, when it comes from our internal Outlook server, it doesn't get added to the calendar.
A message is shown underneath the grayed-out meeting controls: "As the meeting organizer, you do not need to respond to this meeting."
Example ICalendar file generated by our system:
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//MyCompany//Product//EN
CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
DTSTAMP:20101202T210423Z
UID:77B17E9B-BE02-476E-816B-ED9558EE7D2A
DTSTART:20101230T133000
DTEND:20101230T143000
SUMMARY:Review Meeting for A1 CI Review #123456
LOCATION:BLDG - 123
CREATED:20101202T210423Z
LAST-MODIFIED:20101202T210423Z
TZID:America/New_York
ORGANIZER;CN="ORGANIZER, THE";SENT-BY="mailto:noemail@mycompany.com":mailto:myemail@mycompany.com
ATTENDEE;ROLE=REQ-PARTICIPANT;CN="ATTENDEE, SOME":mailto:noemail@mycompany.com
END:VEVENT
END:VCALENDAR
Edit:
I tried adding the meeting organizer as an "Optional to" participant. No dice; same behavior.
Edited the question again to reflect my progress on the issue.
Source: (StackOverflow)
My HTML email newsletter design doesn't render properly in Outlook 2007. There is a white horizontal gap towards the bottom which breaks borders and backgrounds. I've had this happen before and have no idea how to work around it. Any suggestions? I've posted the source here. It renders just fine except in Outlook 2007 (Word 2007).
By the way, you can preview the problem without Outlook, by opening the source with Word 2007.
Source: (StackOverflow)
So I have a dropdown menu in a ribbon with contents that can be changed while it is being used. Outlook is also happy to let me 'add' or 'insert' items into it, as long as I do not add more than 1 item.
If I try to, I'll be told that the index is out of bounds rather than expanding the upper bounds for me.
I find that if I insert it into the collection in the designer portion of the code, it will work fine, but designer code is only run once, unless I Dispose the ribbon and re-create it.
Any ideas regarding how I can get this working
Source: (StackOverflow)
I made an HTML Email Template that is working fine in most email readers, but the background images are not showing in Outlook 2007, 2010, and 2013. How can I solve the problem?
Here's the HTML for the email:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
* {
padding: 0px;
margin: 0px;
border: 0px;
outline: 0px;
}
.ExternalClass {width:100%;}
.ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;}
body {-webkit-text-size-adjust:none; -ms-text-size-adjust:none;}
body {margin:0; padding:0;}
table td {border-collapse:collapse;}
img {max-width:100%;}
</style>
</head>
<body>
<table width="600" cellpadding="0" cellspacing="0" border="0" style="margin:0px auto;padding:0px;display: block;">
<tr>
<td>
<table width="97%" cellpadding="0" cellspacing="0" background="http://3.bp.blogspot.com/-cD1FNllXzaw/UXa8tPE_YGI/AAAAAAAAAQs/0GNzMQJ73jU/s1600/pink_bkg.png" style="background-image:url('http://3.bp.blogspot.com/-cD1FNllXzaw/UXa8tPE_YGI/AAAAAAAAAQs/0GNzMQJ73jU/s1600/pink_bkg.png');margin:0px auto;font-family: GothamBold, Tahoma;">
<tr>
<td bgcolor="#8cb243" style=" width:97%; height:10px;"></td>
</tr>
<tr>
<td align="center" valign="top" style="margin:0px auto;padding-bottom:30px;height:145px; width:581px;">
<img src="http://3.bp.blogspot.com/-tQV21MgLHUg/UXa8r4MQXpI/AAAAAAAAAQc/MKgOlDjXPOE/s1600/logo.png" width="223" height="132" alt="logo" style="display:block;"/>
</td>
</tr>
<tr>
<td align="center" style="font-size:36px;color:#ffffff;text-transform:uppercase;font-weight:bold;-webkit-text-shadow: 2px 2px 2px #541284;-moz-text-shadow: 2px 2px 2px #541284;text-shadow:2px 2px 2px #541284;margin-bottom:5px;height:25px; width:581px;">Massive 40% discount</td>
</tr>
<tr>
<td align="center" style="font-size:28px;color:#cda6e6 !important;text-transform:uppercase;font-weight:bold;-webkit-text-shadow:2px 2px 2px #541284;-moz-text-shadow:2px 2px 2px #541284;text-shadow:2px 2px 2px #541284;height:15px; width:581px;">on <a rel='nofollow' href="#" target="_blank" style="color:#cda6e6 !important;font-weight:bold;text-decoration:none;" >the gift you just selected</a></td>
</tr>
<tr>
<td align="center" style="font-size:36px;font-weight:bold;-webkit-text-shadow:2px 2px 2px #541284;-moz-text-shadow:2px 2px 2px #541284;text-shadow:2px 2px 2px #541284;padding-bottom:60px;color:#ffffff;height:20px; width:581px;">for <span style="color:#ffffff !important;">aaa@aaa.com!</span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" cellpadding="0" cellspacing="0" border="0" height="83" background="http://2.bp.blogspot.com/-9VyAxADMv1Q/UXa8rfeT8fI/AAAAAAAAAQU/XmNd44ekFLA/s1600/header_bottom.png" style="background-image:url('http://2.bp.blogspot.com/-9VyAxADMv1Q/UXa8rfeT8fI/AAAAAAAAAQU/XmNd44ekFLA/s1600/header_bottom.png');background-repeat:no-repeat;" >
<tr>
<td align="center" style="font-family:GothamBold, Tahoma;font-size:14px;text-transform:uppercase;color:#000000;padding-top:20px;font-weight:bold;letter-spacing:1px;">Buy it today to take advantage of this huge discount.</td>
</tr>
<tr>
<td align="center" style="font-family: GothamBold, Tahoma;font-size:18px;color:#7519a3;text-transform:uppercase;font-weight:900;padding-bottom:20px;">Our little secret!</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
Source: (StackOverflow)