Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Outlook View Control

Posted on 2011-10-19
5
Medium Priority
?
323 Views
Last Modified: 2012-05-12
Hello,

In my script, I have code that indicates what folder to look at for my Outlook View Control.  

Set oCSIFolder = oNS.Folders("Public Folders").Folders("All Public Folders").Folders("Tasks-FramesII")

This works in 2007.  Since upgrading to 2010, it doesn't work.  2010 shows the address of the public folder differently like this:

\\Public Folders - Joel@myworkdomain.com\All Public Folders\Tasks-FramesII

I have people working in 2007 and 2010.  I need to come up with a fix that will work in both environments.

Thanks,
Joel
0
Comment
Question by:Genius123
  • 3
  • 2
5 Comments
 
LVL 12

Expert Comment

by:prashanthd
ID: 36998579
Can you post the script? Secondly "Joel@myworkdomain.com" is this static?
0
 

Author Comment

by:Genius123
ID: 37000387
Joel@myworkdomain.com will change depending on the user.  It seems to you would need to check what outlook version you were running in the code?  I will post the code.  THanks.
Sub CommandButtonOpenMain_Click()
	Dim oParent
	Dim oNS
	Dim oFolder

	On Error Resume Next

if JobYearNow - JobYear < 2 then
  	Set oNS = Nothing
  	Set oNS = Application.GetNamespace("MAPI")
	
	set oFolder = Nothing
	Set oFolder = oNS.Folders("Public Folders").Folders("All Public Folders").Folders("Tasks-FramesII")
	Set oParent = Nothing
	Set oParent = oFolder.Items.Find("[JobNumber] = '" & Item.UserProperties("JobNumber").Value & "' and " & "[Message Class] = 'IPM.Task.Monster'")
	else
  	Set oNS = Nothing
  	Set oNS = Application.GetNamespace("MAPI")
	
	set oFolder = Nothing
	Set oFolder = oNS.Folders("Public Folders").Folders("All Public Folders").Folders("Tasks-FramesII").Folders(JobYearNow-(JobYearNow - JobYear)&"_Archive")
	Set oParent = Nothing
	Set oParent = oFolder.Items.Find("[JobNumber] = '" & Item.UserProperties("JobNumber").Value & "' and " & "[Message Class] = 'IPM.Task.Monster'")
end if

	oParent.Display
	Item.Close 0	'olSave = 0, olDiscard = 1

	set oFolder = Nothing
	Set oParent = Nothing

End Sub

Open in new window

0
 
LVL 12

Expert Comment

by:prashanthd
ID: 37010640
The following code will tell Outlook Version
Const HKEY_CLASSES_ROOT    = &H80000000
Const HKEY_CURRENT_USER    = &H80000001
Const HKEY_LOCAL_MACHINE   = &H80000002
Const HKEY_USERS     = &H80000003
Const HKEY_CURRENT_CONFIG  = &H80000005
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "Outlook.Application\CurVer"
strValueName = ""
oReg.GetStringValue HKEY_CLASSES_ROOT, strKeyPath, strValueName, strValue

If Replace(strValue,"Outlook.Application.","") = "12" Then 
    WScript.Echo "2007"
ElseIf Replace(strValue,"Outlook.Application.","") = "12" Then 
    WScript.Echo "2010"
End If

Open in new window

0
 
LVL 12

Accepted Solution

by:
prashanthd earned 1000 total points
ID: 37010643
Change Line No 14

ElseIf Replace(strValue,"Outlook.Application.","") = "14" Then
0
 

Author Closing Comment

by:Genius123
ID: 37038198
THanks.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to import Lotus Notes Contacts into Outlook 2016, 2013, 2010 and 2007 etc. with a few manual steps. You can easily export and migrate Lotus Notes contacts into Microsoft Outlook without having to use any third party tools.
By default Outlook 2016 displays only one time zone in the Calendar. The following article explains how to display two time zones in one calendar view.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question