msoutlook.org Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to set the active printer for Outlook 2003

 
Post new topic   Reply to topic    msoutlook.org Forum Index -> Outlook Programs Add-Ins
Author Message
Mohamed Shafi P K



Joined: 29 Jan 2008
Posts: 3

PostPosted: Tue Jan 29, 2008 4:24 am    Post subject: How to set the active printer for Outlook 2003 Reply with quote

Hi,

I have to write an Outlook 2003 COM add-in that prints the active item to a
perticular printer. I have used a toolbar button for this purpose. Clicking
the button will direct the print to my printer. This is my idea.

I searched through the Outlook object model and I could not find a method to
set the active printer in any of the Outlook interfaces. I had wrote similar
add-ins in other Office applications (Word, Excel, PowerPoint etc.). All
these applications have interface functions put_ActivePrinter() &
get_ActivePrinter(). Only information I have is that Outlook takes the system
default printer as the active printer at startup and use the last used one
when a user manually changes/print to a printer.

Please help me if anyone has any idea to set the active printer in Outlook.

Thanks

Archived from group: microsoft>public>outlook>program_addins
Back to top
View user's profile Send private message
Sue Mosher [MVP-Outlook]



Joined: 12 Aug 2007
Posts: 656

PostPosted: Tue Jan 29, 2008 3:05 pm    Post subject: Re: How to set the active printer for Outlook 2003 Reply with quote

You found nothing because there is nothing. You'd have to use Windows techniques to change the system default printer. Or, save the item as a ..txt, .htm, or .rtf file, open it in Word and use Word's methods.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Mohamed Shafi P K" wrote in message @microsoft.com...
> Hi,
>
> I have to write an Outlook 2003 COM add-in that prints the active item to a
> perticular printer. I have used a toolbar button for this purpose. Clicking
> the button will direct the print to my printer. This is my idea.
>
> I searched through the Outlook object model and I could not find a method to
> set the active printer in any of the Outlook interfaces. I had wrote similar
> add-ins in other Office applications (Word, Excel, PowerPoint etc.). All
> these applications have interface functions put_ActivePrinter() &
> get_ActivePrinter(). Only information I have is that Outlook takes the system
> default printer as the active printer at startup and use the last used one
> when a user manually changes/print to a printer.
>
> Please help me if anyone has any idea to set the active printer in Outlook.
>
> Thanks
Back to top
View user's profile Send private message
Mohamed Shafi P K



Joined: 29 Jan 2008
Posts: 3

PostPosted: Thu Jan 31, 2008 1:49 am    Post subject: Re: How to set the active printer for Outlook 2003 Reply with quote

Thanks for your information Sue.

Actually, I tried both methods you suggested:
1. I tried using Word method - I saved a mail item as html, created a word
instance inside my add-in, added a new document in word, inserted the html
file in to the document, set the active printer to my required printer, fired
the print. In this case, it works fine if my mail item has only text. But, if
it has some embedded images, it will miss in the printout. I opened the saved
html file, images are missing there also. It seems to me that Outlook uses
some internal mapping to the images used in the mail item.

I could not save the mail item as .Rtf or .doc . SaveAs function fails in
this case. (Word is my default e-mail editor - MSDN help says that "the olDoc
constant works only if Microsoft Word is set up as the default email
editor".). If it was possible, I can easily open the Rtf/Doc item using Word
Smile


2. I used another process to create an Outlook instance for printing. I
changed the system default printer to my desired printer before creating
Outlook instance. I created a new mail item, put the HTML body with the
content from saved html file. This also works fine if it has text only.
Images are missing in this case also.

I could save the images used in the Outlook mail item. But I could not map
the images to the links used in the HTML to resolve the image missing problem.
I could save the mail item as .msg file, but i dont know how to open it
using Outlook interfaces. I could not found any interface methods Sad

Could you please help me regarding this? I also heared about redemption can
be used to import .msg files to Outlook. Is that possible?

Thanks in Advance


"Sue Mosher [MVP-Outlook]" wrote:

> You found nothing because there is nothing. You'd have to use Windows techniques to change the system default printer. Or, save the item as a ..txt, .htm, or .rtf file, open it in Word and use Word's methods.
>
> --
> Sue Mosher, Outlook MVP
> Author of Microsoft Outlook 2007 Programming:
> Jumpstart for Power Users and Administrators
> http://www.outlookcode.com/article.aspx?id=54
>
>
> "Mohamed Shafi P K" wrote in message @microsoft.com...
> > Hi,
> >
> > I have to write an Outlook 2003 COM add-in that prints the active item to a
> > perticular printer. I have used a toolbar button for this purpose. Clicking
> > the button will direct the print to my printer. This is my idea.
> >
> > I searched through the Outlook object model and I could not find a method to
> > set the active printer in any of the Outlook interfaces. I had wrote similar
> > add-ins in other Office applications (Word, Excel, PowerPoint etc.). All
> > these applications have interface functions put_ActivePrinter() &
> > get_ActivePrinter(). Only information I have is that Outlook takes the system
> > default printer as the active printer at startup and use the last used one
> > when a user manually changes/print to a printer.
> >
> > Please help me if anyone has any idea to set the active printer in Outlook.
> >
> > Thanks
>
Back to top
View user's profile Send private message
Sue Mosher [MVP-Outlook]



Joined: 12 Aug 2007
Posts: 656

PostPosted: Thu Jan 31, 2008 4:57 pm    Post subject: Re: How to set the active printer for Outlook 2003 Reply with quote

1) If embedded images are involved, that requires extra work -- saving the image attachments and updating to point to the saved image files.

You can save as .rtf only if the message format is RTF.

2) That's the same HTML image problem as #1. There should be no need to create a new Outlook instance, as only one Outlook session can be running at a time.

The code sample at http://www.outlookcode.com/codedetail.aspx?id=212 shows how to open a .vcf file programmatically with the Windows Shell. The same technique should work for .msg files. Instead of colInsp.Item(1).CurrentItem.Save you could use colInsp.Item(1).CurrentItem.PrintOut.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Mohamed Shafi P K" wrote in message @microsoft.com...
> Thanks for your information Sue.
>
> Actually, I tried both methods you suggested:
> 1. I tried using Word method - I saved a mail item as html, created a word
> instance inside my add-in, added a new document in word, inserted the html
> file in to the document, set the active printer to my required printer, fired
> the print. In this case, it works fine if my mail item has only text. But, if
> it has some embedded images, it will miss in the printout. I opened the saved
> html file, images are missing there also. It seems to me that Outlook uses
> some internal mapping to the images used in the mail item.
>
> I could not save the mail item as .Rtf or .doc . SaveAs function fails in
> this case. (Word is my default e-mail editor - MSDN help says that "the olDoc
> constant works only if Microsoft Word is set up as the default email
> editor".). If it was possible, I can easily open the Rtf/Doc item using Word
> Smile
>
>
> 2. I used another process to create an Outlook instance for printing. I
> changed the system default printer to my desired printer before creating
> Outlook instance. I created a new mail item, put the HTML body with the
> content from saved html file. This also works fine if it has text only.
> Images are missing in this case also.
>
> I could save the images used in the Outlook mail item. But I could not map
> the images to the links used in the HTML to resolve the image missing problem.
> I could save the mail item as .msg file, but i dont know how to open it
> using Outlook interfaces. I could not found any interface methods Sad
>
> Could you please help me regarding this? I also heared about redemption can
> be used to import .msg files to Outlook. Is that possible?
>
> Thanks in Advance
>
>
> "Sue Mosher [MVP-Outlook]" wrote:
>
>> You found nothing because there is nothing. You'd have to use Windows techniques to change the system default printer. Or, save the item as a ...txt, .htm, or .rtf file, open it in Word and use Word's methods.
>>
>> "Mohamed Shafi P K" wrote in message @microsoft.com...
>> > Hi,
>> >
>> > I have to write an Outlook 2003 COM add-in that prints the active item to a
>> > perticular printer. I have used a toolbar button for this purpose. Clicking
>> > the button will direct the print to my printer. This is my idea.
>> >
>> > I searched through the Outlook object model and I could not find a method to
>> > set the active printer in any of the Outlook interfaces. I had wrote similar
>> > add-ins in other Office applications (Word, Excel, PowerPoint etc.). All
>> > these applications have interface functions put_ActivePrinter() &
>> > get_ActivePrinter(). Only information I have is that Outlook takes the system
>> > default printer as the active printer at startup and use the last used one
>> > when a user manually changes/print to a printer.
>> >
>> > Please help me if anyone has any idea to set the active printer in Outlook.
>> >
>> > Thanks
>>
Back to top
View user's profile Send private message
Mohamed Shafi P K



Joined: 29 Jan 2008
Posts: 3

PostPosted: Thu Feb 07, 2008 8:55 am    Post subject: Re: How to set the active printer for Outlook 2003 Reply with quote

1) I could save the image attachments to a local folder from a mail item. But
I could not map the image src path in the HTML file to the saved image path
correctly in all the cases.

I used the display name property of the attachment to find a match with the
image reference in the HTML. I looked for the display name inside the image
src path. If there is the display name embedded inside the image src path, I
replaced the src path to that of the local disk path (For example, if I have
an attachment with display name=“image001.jpg”, I will replace an image
src=”cid:image001.jpg@01C8568E.479AEF20” with
src="C:\DOCUME~1\mohamed\LOCALS~1\Temp\1F137BC2\image001.jpg"). Most of the
cases, it works fine. But some cases image src path does not contain the
display name of the attachment (It has some number/code like
src="cid:006801c7f42e$d246b270$89c710c1@IVLGROUP).

I tried to use the index property of the attachment to map to the image src
path. Here, i tried to map the image src paths with the index order of the
attachments. But, in cases where images repeated in the mail item; it fails.

How we can map the image src path with the attachment?

2) I used another Outlook instance just to set the active printer as my
desired printer. I used another process (not from the add-in) to create an
Outlook instance.


"Sue Mosher [MVP-Outlook]" wrote:

> 1) If embedded images are involved, that requires extra work -- saving the image attachments and updating to point to the saved image files.
>
> You can save as .rtf only if the message format is RTF.
>
> 2) That's the same HTML image problem as #1. There should be no need to create a new Outlook instance, as only one Outlook session can be running at a time.
>
> The code sample at http://www.outlookcode.com/codedetail.aspx?id=212 shows how to open a .vcf file programmatically with the Windows Shell. The same technique should work for .msg files. Instead of colInsp.Item(1).CurrentItem.Save you could use colInsp.Item(1).CurrentItem.PrintOut.
>
> --
> Sue Mosher, Outlook MVP
> Author of Microsoft Outlook 2007 Programming:
> Jumpstart for Power Users and Administrators
> http://www.outlookcode.com/article.aspx?id=54
>
>
> "Mohamed Shafi P K" wrote in message @microsoft.com...
> > Thanks for your information Sue.
> >
> > Actually, I tried both methods you suggested:
> > 1. I tried using Word method - I saved a mail item as html, created a word
> > instance inside my add-in, added a new document in word, inserted the html
> > file in to the document, set the active printer to my required printer, fired
> > the print. In this case, it works fine if my mail item has only text. But, if
> > it has some embedded images, it will miss in the printout. I opened the saved
> > html file, images are missing there also. It seems to me that Outlook uses
> > some internal mapping to the images used in the mail item.
> >
> > I could not save the mail item as .Rtf or .doc . SaveAs function fails in
> > this case. (Word is my default e-mail editor - MSDN help says that "the olDoc
> > constant works only if Microsoft Word is set up as the default email
> > editor".). If it was possible, I can easily open the Rtf/Doc item using Word
> > Smile
> >
> >
> > 2. I used another process to create an Outlook instance for printing. I
> > changed the system default printer to my desired printer before creating
> > Outlook instance. I created a new mail item, put the HTML body with the
> > content from saved html file. This also works fine if it has text only.
> > Images are missing in this case also.
> >
> > I could save the images used in the Outlook mail item. But I could not map
> > the images to the links used in the HTML to resolve the image missing problem.
> > I could save the mail item as .msg file, but i dont know how to open it
> > using Outlook interfaces. I could not found any interface methods Sad
> >
> > Could you please help me regarding this? I also heared about redemption can
> > be used to import .msg files to Outlook. Is that possible?
> >
> > Thanks in Advance
> >
> >
> > "Sue Mosher [MVP-Outlook]" wrote:
> >
> >> You found nothing because there is nothing. You'd have to use Windows techniques to change the system default printer. Or, save the item as a ...txt, .htm, or .rtf file, open it in Word and use Word's methods.
> >>
> >> "Mohamed Shafi P K" wrote in message @microsoft.com...
> >> > Hi,
> >> >
> >> > I have to write an Outlook 2003 COM add-in that prints the active item to a
> >> > perticular printer. I have used a toolbar button for this purpose. Clicking
> >> > the button will direct the print to my printer. This is my idea.
> >> >
> >> > I searched through the Outlook object model and I could not find a method to
> >> > set the active printer in any of the Outlook interfaces. I had wrote similar
> >> > add-ins in other Office applications (Word, Excel, PowerPoint etc.). All
> >> > these applications have interface functions put_ActivePrinter() &
> >> > get_ActivePrinter(). Only information I have is that Outlook takes the system
> >> > default printer as the active printer at startup and use the last used one
> >> > when a user manually changes/print to a printer.
> >> >
> >> > Please help me if anyone has any idea to set the active printer in Outlook.
> >> >
> >> > Thanks
> >>
>
Back to top
View user's profile Send private message
Sue Mosher [MVP-Outlook]



Joined: 12 Aug 2007
Posts: 656

PostPosted: Thu Feb 07, 2008 1:30 pm    Post subject: Re: How to set the active printer for Outlook 2003 Reply with quote

You may need to use a low-level API such as CDO 1.21 or Redemption to examine hidden properties of the attachments to determine a match for the image source. The attachment's &H3712001E field should contain the CID. [TIP: A tool like Outlook Spy (http://www.dimastr.com/outspy/) or MFCMAPI.exe is a good tool for locating what fields contain the information you need. ]

The index order is not going to be helpful in this instance.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Mohamed Shafi P K" wrote in message @microsoft.com...
> 1) I could save the image attachments to a local folder from a mail item. But
> I could not map the image src path in the HTML file to the saved image path
> correctly in all the cases.
>
> I used the display name property of the attachment to find a match with the
> image reference in the HTML. I looked for the display name inside the image
> src path. If there is the display name embedded inside the image src path, I
> replaced the src path to that of the local disk path (For example, if I have
> an attachment with display name=“image001.jpg”, I will replace an image
> src=”cid:image001.jpg@01C8568E.479AEF20” with
> src="C:\DOCUME~1\mohamed\LOCALS~1\Temp\1F137BC2\image001.jpg"). Most of the
> cases, it works fine. But some cases image src path does not contain the
> display name of the attachment (It has some number/code like
> src="cid:006801c7f42e$d246b270$89c710c1@IVLGROUP).
>
> I tried to use the index property of the attachment to map to the image src
> path. Here, i tried to map the image src paths with the index order of the
> attachments. But, in cases where images repeated in the mail item; it fails.
>
> How we can map the image src path with the attachment?
>
> 2) I used another Outlook instance just to set the active printer as my
> desired printer. I used another process (not from the add-in) to create an
> Outlook instance.
>
>
> "Sue Mosher [MVP-Outlook]" wrote:
>
>> 1) If embedded images are involved, that requires extra work -- saving the image attachments and updating to point to the saved image files.
>>
>> You can save as .rtf only if the message format is RTF.
>>
>> 2) That's the same HTML image problem as #1. There should be no need to create a new Outlook instance, as only one Outlook session can be running at a time.
>>
>> The code sample at http://www.outlookcode.com/codedetail.aspx?id=212 shows how to open a ..vcf file programmatically with the Windows Shell. The same technique should work for .msg files. Instead of colInsp.Item(1).CurrentItem.Save you could use colInsp.Item(1).CurrentItem.PrintOut.

>>
>> "Mohamed Shafi P K" wrote in message @microsoft.com...
>> > Thanks for your information Sue.
>> >
>> > Actually, I tried both methods you suggested:
>> > 1. I tried using Word method - I saved a mail item as html, created a word
>> > instance inside my add-in, added a new document in word, inserted the html
>> > file in to the document, set the active printer to my required printer, fired
>> > the print. In this case, it works fine if my mail item has only text. But, if
>> > it has some embedded images, it will miss in the printout. I opened the saved
>> > html file, images are missing there also. It seems to me that Outlook uses
>> > some internal mapping to the images used in the mail item.
>> >
>> > I could not save the mail item as .Rtf or .doc . SaveAs function fails in
>> > this case. (Word is my default e-mail editor - MSDN help says that "the olDoc
>> > constant works only if Microsoft Word is set up as the default email
>> > editor".). If it was possible, I can easily open the Rtf/Doc item using Word
>> > Smile
>> >
>> >
>> > 2. I used another process to create an Outlook instance for printing. I
>> > changed the system default printer to my desired printer before creating
>> > Outlook instance. I created a new mail item, put the HTML body with the
>> > content from saved html file. This also works fine if it has text only.
>> > Images are missing in this case also.
>> >
>> > I could save the images used in the Outlook mail item. But I could not map
>> > the images to the links used in the HTML to resolve the image missing problem.
>> > I could save the mail item as .msg file, but i dont know how to open it
>> > using Outlook interfaces. I could not found any interface methods Sad
>> >
>> > Could you please help me regarding this? I also heared about redemption can
>> > be used to import .msg files to Outlook. Is that possible?
>> >
>> > Thanks in Advance
>> >
>> >
>> > "Sue Mosher [MVP-Outlook]" wrote:
>> >
>> >> You found nothing because there is nothing. You'd have to use Windows techniques to change the system default printer. Or, save the item as a ...txt, .htm, or .rtf file, open it in Word and use Word's methods.
>> >>
>> >> "Mohamed Shafi P K" wrote in message @microsoft.com...
>> >> > Hi,
>> >> >
>> >> > I have to write an Outlook 2003 COM add-in that prints the active item to a
>> >> > perticular printer. I have used a toolbar button for this purpose. Clicking
>> >> > the button will direct the print to my printer. This is my idea.
>> >> >
>> >> > I searched through the Outlook object model and I could not find a method to
>> >> > set the active printer in any of the Outlook interfaces. I had wrote similar
>> >> > add-ins in other Office applications (Word, Excel, PowerPoint etc.). All
>> >> > these applications have interface functions put_ActivePrinter() &
>> >> > get_ActivePrinter(). Only information I have is that Outlook takes the system
>> >> > default printer as the active printer at startup and use the last used one
>> >> > when a user manually changes/print to a printer.
>> >> >
>> >> > Please help me if anyone has any idea to set the active printer in Outlook.
>> >> >
>> >> > Thanks
>> >>
>>

Back to top
View user's profile Send private message
Display posts from previous:   
Related Topics:
Outlook 2003 Advanced Search and display results Hi, I'm trying to use outlook 2003 plug in application method to search on multiple public, inbox with sub folders and than display the results on outlook windows. I encountered several problems in the process: 1) display: Enter the search

Outlook und Outlook Connector? Fehler! Hallo zusammen Ich habe Office 2003 (ohne Outlook) und Office 2007 (mit Outlook) installiert. Nun wollte ich heute den Outlook Connector installieren. Bei der Installation ergaben sich eigentlich keine Probleme. Ich kann jetzt nur kein Konto hinzufgen. W

Outlook Connector I've been using the Outlook Connector for Domino for over a year with pretty good success. This past weekend it looks like the Domino changed something and all of my Domino mail now looks different. instead of showing the sender's short nam

Live Local add-in for Outlook fails install I have Win XP SP2, Office 2003 SP2. I had the beta version of Windows Live Local add-in for Outlook, which stopped working when IE7 was out. So I uninstalled the add-in using Add/Remove programs. The Windows Live Local add-in does not appear in my Add/

How to add envid,notify and ret parameters to Outlook mail ? I'm writing an application as plugin to Outlook 2003 using VSTO. Now I have a big problem. I tried to add envid,notify and ret parameters to message header (MailItem) but I got stuck. According to SMTP envid and ret must be a
Post new topic   Reply to topic    msoutlook.org Forum Index -> Outlook Programs Add-Ins All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group