How do I remove IIS based components from InstallShield in an upgrade? - installshield

In trying to create a major upgrade existing web applications with InstallShield as suggested here I have created a new application pool, but can't create a new IIS application. However while the new install creates the new pool, it doesn't change the existing virtual directory to use the new pool. The logs say virtual directory already exists and leaves it at that.
Is it possible to get the install to change an existing component, or simply how do I delete the virtual directory component since the remove files table expects a directory?
Thanks

Ended up achieving this by
Created a Property called WEBSITENAME with the value of the website name from the String Editor table (this is for reuse)
Created a VBscript custom action, to run after RemoveFolders with the following condition: IIS_VERSION <= "#6" and NOT INSTALLED
The code is:
Dim objWebServer
Dim objVirtualDir
Dim strAppName
Dim intASPSessionTimeout
Dim SubVirtDir
On Error Resume Next
CreateApplication = ERROR_SUCCESS
strAppName = Session.Property("WEBSITENAME")
SubVirtDir = "/" + strAppName
intASPSessionTimeout = 120
Set objWebServer = GetObject("IIS://localhost/W3SVC/1/Root")
'Delete the Virtual subdirectory
Set objVirtualDir = objWebServer.Delete("IISWebVirtualDir", SubVirtDir)
Set objVirtualDir = objWebServer.Delete("IISWebVirtualDir", strAppName)
This does what I needed to do. Now I need to figure out a similar way to conditionally Enable32bitAppOnWin64!

Related

How to access file resource via LotusScript

I want to access and use shared file. I considered these approaches:
1. Store the attachment in Notes Document
2. Store the attachment in database profile
but in both cases I will need to add extra UI design elements (form, view... )
So the easiest way to maintain it - use db Resources (images or files).
I need to create LotusSrcit action that would access the file from db Resources and attach it into new NotesDocument that will be sent as an email.
1 and #2 easy to implement. But how can I access certain file resource from db Resources?
You can access file or image resources using the NotesNoteCollection class. However, since Notes stores the attached files or images in its own, internal format, it is not easy -- if at all possible -- to access those attachments using pure LotusScript.
A workaround that I found useful is to attach the file to an Applet resource, where it can be accessed using pure LotusScript; see sample code below.
Dim sn As New NotesSession()
Dim db as NotesDatabase
Dim nc As NotesNoteCollection
Dim designNote As NotesDocument
Dim eo As NotesEmbeddedObject
Dim noteID$, myFileName$
myFileName = "foobar.txt"
Set db = sn.CurrentDatabase
Set nc = db.CreateNoteCollection(False)
nc.SelectJavaResources = True 'select all Applet resources
nc.SelectionFormula = {$TITLE="} + myFileName + {"} 'assuming the Applet resource has the same name as the file
Call nc.BuildCollection()
noteID = nc.GetFirstNoteID()
Do Until Len(noteID) = 0
Set designNote = db.GetDocumentByID(noteID)
Set eo = designNote.GetAttachment(myFileName)
If Not (eo Is Nothing) Then
'----- your code goes here -----
Exit Do
End If
noteID = nc.GetNextNoteID(noteID)
Loop
I'm making two assumptions here:
The name of the file you want to access is known ("foobar.txt" in the sample code). This is necessary, since otherwise you won't be able to access the attachment.
The Applet resource has the same name as the attached file. Not necessary, but convenient for being able to filter the NotesNoteCollection by the very name of the attached file.

LotusScript:Agents on schedule does not run DbLookup

I'm writing a LotusScript agent that runs on schedule. In the script, there is a line that
goes something like
Dim eval as Variant
eval = Evaluate({#DbLookup( "": ""; "SVR1": "db.nsf"; "aView"; "KeyValue"; 4})
Where SVR1 is the servername, db.nsf is the database, aView is the view and KeyValue is the key used to access the desired record(s). The last number 4 is the column number of the view that we want the value from.
I've been doing this for awhile and no problems. Only now does the script seem not to run on schedule. It works if i run it manually via the designer. I've used NotesLog to do debug and i noticed the agents stops right at that line. The db it is looking up is on another server.
What is causing this script to fail?
Seems that you are trying to connect to the server, different than the agent is running on.
In the old lotus versions there was a strict rule, you was not able to connect to another server in the scheduled agent.
I.e if you ran your scheduled agent on the server: SRV0 you was able only to get information from the server SRV0.
Later (if I recall correctly in Domino 6.0 and later) the new term included: trusted server.
So, if you want to access another server from your scheduled agents you need to register this server as a trusted server.
To add server to trusted servers list, open your server document in the server address book.
Go to Security tab and specify trusted servers in the corresponding field.
I recommend to not use the Evaluate in a such way. Instead of this is better to use native LotusScript objects like NotesDatabase, NotesView and so on:
Dim db As New NotesDatabase("", "")
Dim view As NotesView
Dim vc As NotesViewEntryCollection
Dim entry As NotesViewEntry
Dim eval as Variant
Call db.Open("SRV1/OrgUnit/Organization", "db.nsf")
Set view = db.GetView("aView")
Set vc = view.GetAllEntriesByKey("KeyValue", True)
If vc.Count = 0 Then
Exit Sub
End If
Redim eval(vc.Count - 1)
Set entry = vc.GetFirstEntry
index% = -1
Do While Not entry is Nothing
index% = index% + 1
eval(index%) = entry.ColumnValues(3)
Set entry = vc.GetNextEntry(entry)
Loop

Extending WSS3 task lists to support recurring reminders

WSS 3.0 will let me send an email to a group when a new task is added to a task list. What I would like to do is to run a weekly task that sends out reminders of tasks due within certain periods, i.e. 2 days, 7 days, 14 days etc. I thought the simplest way would be to build a little C# app that sits on the WS2K3 box and queries the WSS database. Any ideas on which tables I should be checking? More generally is there an overall schema for the WSS3 database system?
If anyone is aware of an existing solution with code please let me know.
Thx++
Jerry
My suggestions:
don't create a console app, create a class that inherits from SPJobDefinition.
set SPJobLockType.Job to this timer, this will grant that the job is executed only once in the whole farm, even if you are running multiple front-end servers
in the, timer job, open the SPSite, SPWeb objects you need, then find the SPList\
Using SPQuery filter out only the items you need - I believe, you will have to filter out the ones where Status!=Complete
Loop through the results collection (which will be of type SPListItemCollection, apply your rules, checking the DueDate and Datetime.Now, send the e-mails
Since a task is simply a SPListItem, it has a Properties property, which is actually a property bag - you can add whatever properties you need. So, add a property My_LastSentReminderDate. Use this property to check if you are not sending too much of "corporate spam" :-)
To install your SPJobDefinition in a SharePoint farm, you can use a PowerShell script. I can give you examples, if needed.
Don't forget to Threading.Thread.CurrentThread.CurrentCulture = Your_SPWeb_Instance.Locale, otherwise date comparisons may not work if the web has a different locale!
EDIT: This is how a typical reminder looks like in my applications:
Public Class TypicalTimer
Inherits SPJobDefinition
Public Sub New(ByVal spJobName As String, ByVal opApplication As SPWebApplication)
'this way we can explicitly specify we need to lock the JOB
MyBase.New(spJobName, opApplication, Nothing, SPJobLockType.Job)
End Sub
Public Overrides Sub Execute(ByVal opGuid As System.Guid)
'whatever functionality is there in the base class...
MyBase.Execute(Guid.Empty)
Try
Using oSite As SPSite = New SPSite("http://yourserver/sites/yoursite/subsite")
Using oWeb As SPWeb = oSite.OpenWeb()
Threading.Thread.CurrentThread.CurrentCulture = oWeb.Locale
'find the task list and read the "suspects"
Dim oTasks As SPList = oWeb.Lists("YourTaskListTitle")
Dim oQuery As New SPQuery()
oQuery.Query = "<Where><Neq><FieldRef Name='Status'/>" & _
"<Value Type='Choice'>Complete</Value></Neq></Where>"
Dim oUndoneTasks As SPListItemCollection = oTasks.GetItems(oQuery)
'extra filtering of the suspects.
'this can also be done in the query, but I don't know your rules
For Each oUndoneTask As SPListItem In oUndoneTasks
If oUndoneTask(SPBuiltInFieldId.TaskDueDate) IsNot Nothing AndAlso _
CDate(oUndoneTask(SPBuiltInFieldId.TaskDueDate)) < Now().Date Then
' this is where you send the mail
End If
Next
End Using
End Using
Catch ex As Exception
MyErrorHelper.LogMessage(ex)
End Try
End Sub
End Class
To register a timer job, I typically use this kind of a script:
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Administration")
[System.Reflection.Assembly]::LoadWithPartialName("Your.Assembly.Name.Here")
$spsite= [Microsoft.SharePoint.SPSite]("http://yourserver/sites/yoursite/subsite")
$params = [System.String]("This text shows up in your timer job list (in Central Admin)", $spsite.WebApplication
$newTaskLoggerJob = new-object -type Your.Namespace.TypicalTimer -argumentList $params
$schedule = new-object Microsoft.SharePoint.SPDailySchedule
$schedule.BeginHour = 8
$schedule.BeginMinute = 0
$schedule.BeginSecond = 0
$schedule.EndHour = 8
$schedule.EndMinute = 59
$schedule.EndSecond = 59
$newTaskLoggerJob.Schedule = $schedule
$newTaskLoggerJob.Update()
Any time you need something in sharepoint that is executed periodically, 99 times out of a 100 you'll need to build a TimerJob. These are scheduled tasks that run inside SharePoint and you can create your own, then using a feature + featurereceiver to actually "install" the timoerjob (definition) and assign it a schedule.
For more info: see Andrew Connell's article on TimerJobs.
P.S. Never query /update the databases related to SharePoint directly! This will make you "unsupported", i.e. if anything happens microsoft will charge (a lot of) money to come and fix it, instead of being able to ask for regular support. (if you are say an MSDN subscriber you get up to 4 free support calls a year).
Don't bother trying to go directly to the database. You will have a very hard time because it's undocumented, unsupported, and not recommended. SharePoint does in fact have a full featured object model though.
If you reference Microsoft.SharePoint.dll (located in the Global Assembly Cache of a machine with SharePoint installed on it) you can access the data that way. The objects you'll want to start with are SPSite, SPWeb, SPList, SPQuery, and SPListItem. All of which you can find very easily on http://msdn.microsoft.com in a search.
Another less-flexible but code-free possibility you could try is creating several different views that include upcoming tasks then via the GUI set up an alert for when items are added to that view.

COM Integration from ALBPM - Cannot find IDispatch for '{00020906-0000-0000-C000-000000000046}'

I am trying to use the Office COM components in order to create Word and Excel documents. Unfortunately I can not achieve this because I am getting an error.
Cannot find IDispatch for
'{00020906-0000-0000-C000-000000000046}'
in module
'{00020905-0000-0000-C000-000000000046}',
v8.3
I tried reinstalling Office, my application (ALBPM) and my interface (combsvc) but it is not working.
I want to know how can I install IDispatch, or how can I know if it is installed in the correct module. Some times the error says:
Cannot find IDispatch for
'{000209FF-0000-0000-C000-000000000046}'
... instead of
00020906-0000-0000-C000-000000000046
The code I'm using generate these errors is:
wordAppl.visible = false
wordDocs = wordAppl.documents
contratoTemplate = "C:\\albpmFiles\\mandatory\\aTemplate.doc"
// .doc template
convenioTemplate = "C:\\albpmFiles\\mandatory\\ConvenioModificatorio.doc"
// .doc template
saveContrato = "C:\\albpmFiles\\temp\\"
// where to save.
saveConvenio = "C:\\albpmFiles\\temp\\"
contratoName = "NewContact.doc"
wordDoc = open(wordDocs, fileName : contratoTemplate)
bookmark = item(wordDoc.bookmarks, index : "atrDescripcion")
insertAfter bookmark.range
using text = instSolicitud.atrDescripcion
bookmark = item(wordDoc.bookmarks, index : "atrObjProveedor_atrNombre")
insertAfter bookmark.range
using text = instSolicitud.atrObjProveedor.atrNombre
bookmark = item(wordDoc.bookmarks, index : "atrObjProveedor_atrDireccion")
insertAfter bookmark.range
using text = instSolicitud.atrObjProveedor.atrDireccion
filename = saveContrato + contratoName
end
// Extras - Fin
saveAs wordDoc
using fileName = filename
Any information you have about the IDispatch, or these registry entries, well be very appreciated, even if you can tell me where to find more info about this.
Thanks a lot.
Daniel.
From the error you get I assume that you are using Word 2003.
Have you made sure that the COM brigde service is correctly installed and running?
combsvc -install
combsvc -start
will register combsvc as service and then start it.
Please also have a look at the example for Word at the bottom of page 150 in the ALBPM Reference Guide.
The fact that it is sometimes working and sometimes could be an issue with ALBPM. Are you using the latest version and updates?
Another option - and quite frequent problem with Word automation - would be that the automated instance of Word is displaying a modal dialog box and is waiting for user interaction. You can switch of the display of modal dialogs by setting
Application.DisplayAlerts = 0
However, this will unfortunately not prevent all popups from being displayed.
Is there actually an instance of Word started? If so, can you make the Window visible and see if documents can be opened or if there is a popup blocking the application?
Daniel,
I'm taking a stab in the dark here. It looks like you're using BEA systems Aqualogic BPM which I have a feeling is a Java based tool. From digging about it looks like combsvc is actually a COM bridge service to allow ALBPM to speak to COM from Java:
http://edocs.bea.com/albsi/docs60/studio/index.html?t=studio/catalog/catalog_component/COM/c_COM_Bridge.html
I'm thinking this is your point of failure.
About your question on IDispatch, you don't actually install IDispatch. IDispatch is a interface used by COM to expose objects, methods and properties to late bound COM automation clients such as scripting languages (e.g. ASP or VBScript). It's part of the infrastructure of COM, if this was broken you'd see lots more problems with your machine.
I'd probably advise popping a question in here:
http://forums.oracle.com/forums/forum.jspa?forumID=560
To inspect installed COM Interfaces on your PC i suggest you download oleview.exe which is part of the Windows 2003 resource Kit
I actually have {00020906-0000-0000-C000-000000000046} but also no IDispatch interface and get a "Class not registered" error when trying to create an instance of it. My home PC doesn't have office installed just the Office tools which is most likely the cause.
In the past when automating Office Applications i was always able to talk to a version independent ProgID's such as "Excel.Application". Are you sure your referencing the right COM Objects ? Check it out in oleview or give us some more code to munch on :)
The code I am using is this, but I can not even see the first log, so I assume there´s an error with the conection, not with the code
wordAppl.visible = false
wordDocs = wordAppl.documents
contratoTemplate = "C:\\albpmFiles\\mandatory\\aTemplate.doc"
// .doc template
convenioTemplate = "C:\\albpmFiles\\mandatory\\ConvenioModificatorio.doc"
// .doc template
saveContrato = "C:\\albpmFiles\\temp\\"
// where to save.
saveConvenio = "C:\\albpmFiles\\temp\\"
contratoName = "NewContact.doc"
wordDoc = open(wordDocs, fileName : contratoTemplate)
bookmark = item(wordDoc.bookmarks, index : "atrDescripcion")
insertAfter bookmark.range
using text = instSolicitud.atrDescripcion
bookmark = item(wordDoc.bookmarks, index : "atrObjProveedor_atrNombre")
insertAfter bookmark.range
using text = instSolicitud.atrObjProveedor.atrNombre
bookmark = item(wordDoc.bookmarks, index : "atrObjProveedor_atrDireccion")
insertAfter bookmark.range
using text = instSolicitud.atrObjProveedor.atrDireccion
filename = saveContrato + contratoName
end
// Extras - Fin
saveAs wordDoc
using fileName = filename

Set existing Web Service Extension to "Allow" using WiX

In IIS Manager under Web Service Extensions, ASP.NET v2.0.50727 is set to "Prohibited" by default. I would like to set this to Allow during the install.
I am currently using WiX Version 2.
I have tried using:
<Component Id="Allow_WebServiceExtension_ASP.NET_2.0" DiskId="1" Guid="02247363-E423-41E1-AC15-BEF589B65A4D">
<WebServiceExtension Id="WebServiceExtension_ASP.NET_2.0" Allow="yes" File="%SystemRoot%\Microsoft.NET\Framework\[DOTNETFRAMEWORKVER]\aspnet_isapi.dll" Description="ASP.NET v2.0.50727" UIDeletable="no" />
</Component>
This adds a second ASP.NET 2.0.50727 entry and does not enable the first.
I had the same problem using wix3. Since I haven’t found any other solution (??) I decided also to do it with a custom action. With the little difference that I use c# and the WMI support of the framework (System.Management).
using WMI to configure IIS
OK I found out that I just had two misstakes in my Wix
1. the #Group was missing -> I set it to "ASP.NET v2.0.50727"
2. The path to the file was wrong. I had one backslash to much.
After fixing these issues wix-iis:WebServiceExtension worked perfect for me.
Use the WebApplicationExtension Element in WIX, it's in the IISExtension, need to add the reference to the WIX project.
I ended up putting the following code into a custom action:
Dim WebSvcObj As Object
Dim LocatorObj As Object = CreateObject("WbemScripting.SWbemLocator")
Dim ProviderObj As Object = LocatorObj.ConnectServer(".", "root/MicrosoftIISv2", "", "")
WebSvcObj = ProviderObj.get("IIsWebService='w3svc'")
WebSvcObj.EnableWebServiceExtension("ASP.NET v2.0.50727")
It may not be pretty, but it does work.
I modified the code to enable my .NET 4.0 Web Service Extension, using vbScript:
Dim LocatorObj
Dim WebSvcObj
Dim ProviderObj
Set LocatorObj = CreateObject("WbemScripting.SWbemLocator")
Set ProviderObj = LocatorObj.ConnectServer(".", "root/MicrosoftIISv2", "", "")
Set WebSvcObj = ProviderObj.get("IIsWebService='w3svc'")
WebSvcObj.EnableWebServiceExtension("ASP.NET v4.0.30319")

Resources