Cannot enable folder references in Lotus Notes database - lotus-notes

in an external program that accesses various lotus database I get the following error:
Error 4386 occured in line 43: Database does not support folder
references
Usually this program is supposed to enable folder references by itself which doesn't seem to work. So I asked their support and they gave me the following script to enable folder references:
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
If db.FolderReferencesEnabled Then
If Messagebox ("Folder References are enabled." & Chr(10) & Chr(10) _
& "Do you want to disable the Folder References?" ,1 + 32,db.title) = 1 Then
db.FolderReferencesEnabled = False
Messagebox "Disabled Folder References now.....", 64, db.title
Else
Exit Sub
End If
Else
If Messagebox ("Folder References are disabled." & Chr(10) & Chr(10) _
& "Do you want to enable the Folder References?" ,1 + 32,db.title) = 1 Then
db.FolderReferencesEnabled = True
Messagebox "Enabeled Folder References now.....", 64, db.title
End If
End If
I get an error in the line db.FolderReferencesEnabled = True saying the same again:
Database does not support folder references
Does anyone have an idea on how I can enable folder references for a database?
EDIT: The database in question is a replication. I was able to enable folder references in the original database and the folder properties are getting copied.
However, the replica still throws this error that it doesn't support folder references if I try to enable them. Is this an expected behaviour?

The database must have the $FolderInfo and $FolderRefInfo hidden views
to support folder references. These views can be copied from the mail
template.
... according to documentation.
Another cause might be an insufficient access level in ACL for NotesID which executes the code.
Sometimes views are broken. Delete views $FolderInfo and $FolderRefInfo and copy these views from mail template back again.

Our Notes admin was finally able to fix this problem by simply running updall, compact, fixup. We can't say which of these utilities actually fixed the problem though.
Administrator Guide for Domino Server maintenance

Related

Changing the location of a referenced library

I have a C# Library which I use in an Excel VBA project. I wish now wish to restructure my project and want to move the library to a different folder. However after removing the reference to the library and deleting all instances of the library from my computer, the References Available box for the project still shows the reference to the old library location even though it no longer exists on the computer and nothing I do seems to be able to remove that reference.
I don't know if this makes any difference, but the project is an Excel AddIn.
I had this problem back in 2019, and received a response to a question with the same title in April 2019. On that occasion the the issue was resolved by following the advise given. However this time the system stubbornly refuses to play ball.
The procedure that I was advised to follow in 2019 was:
Remove the reference
Save the File and close it
Delete the dll (in my case the .tbl) file from your computer. Do not save it anywhere.
ReOpen the file
Check if there is any reference still there. If not copy the dll to a new folder and then set a reference again. Save and close the file.
ReOpen to check if everything is OK
I was going to try code to remove the reference, but the following code did not find the reference
Sub delRef()
deleteReference ("FiskDLLlib")
End Sub
Sub deleteReference(s As String)
Dim oFs As Object, oReferences As Object, oReference As Object
Dim sFileName As String, sRefName As String, sRefFileName As String
Dim toBeDeletedRef As String
Set oReferences = Application.Workbooks("fiskAIWkBook.xlam").VBProject.References
For Each oReference In oReferences
sRefFileName = oReference.FullPath
sRefName = oReference.name
If sRefName = s Then
toBeDeletedRef = s
Exit For
End If
Next
If toBeDeletedRef <> "" Then
Debug.Print oReference.FullPath
Else
Debug.Print "No Reference found for " & s
End If
End Sub
Similarly the Watches panel didn't show the library.
I have subsequently discovered a registry key
\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib{B22F6C9D-53E0-4D1B-9596-56AA1EA4BDBA}\1.0\0\win32
the value of which was set to the location of the reference I am trying to remove. I changed this to a reference to the new location in which I want to store my dll (.tlb) file. This at least looked like it would allow me to create a new reference in the References box but on clicking OK I got a message saying "Error in loading DLL"
I resolved my problem in the end by removing all references to the library in the Registry with a registry Cleanup tool (ReImage) before copying the library to its new directory and then reregistering it with regASM

Do the DSOFile functions only apply to the non-binary Excel Document types?

Using Windows 10 (Build 1903 if that's relevant?) and 64bit Office 365 (probably relevant?) I've implemented a system that allows me to version control Excel VBA code.
I'm using the Workbook_BeforeSave method to check whether the current file is saved or not, and if it is saved, where it is saved to.
This works fine and will prompt the user as to whether they want to update the code contained within. I then thought that maybe I should in fact check if the code "needs" to be updated prior to prompting the user.
First off, I found the following question/solution: Using VBA to read the metadata or file properties of files in a SharePoint doc library
which I couldn't use without DSOFile.dll that I was able to install from here:
https://www.microsoft.com/en-us/download/details.aspx?id=8422
Here follows the code I have which doesn't work:
Private Function CheckTemplateIsNewerThanCurrentFile(ByVal templatePath As String) As Boolean
Dim templateName As String
Dim fso As New FileSystemObject
templateName = ActiveWorkbook.CustomDocumentProperties("TemplateName").Value
If fso.FileExists(templatePath & "\" & LocalTemplateName) Then
Dim objDSO As New DSOFile.OleDocumentProperties
objDSO.Open templatePath & "\" & LocalTemplateName, True, dsoOptionDefault
If Not objDSO.CustomProperties("LastCommitDate") = ActiveDocument.CustomDocumentProperties("LastCommitDate").Value Then
CheckTemplateIsNewerThanCurrentFile = False
Else
CheckTemplateIsNewerThanCurrentFile = True
TemplateLastCommitDate = objDSO.CustomProperties.Item("LastCommitDate")
End If
End If
End Function
And here (highlighted) is the error I receive trying to run the method above on an .xlsb file:
(FWIW: the reason for use of the .xlsb format is because we're working with 500K+ rows of data in the process we're carrying out. Yes, I know Excel is ABSOLUTELY NOT the tool for this but we're lumbered with it now)
I know I could have already tried changing the file format to .xlsm but because this file is version controlled that is a pain to do if the method is still likely to fail.
Thanks in advance,
Alex.

How to discover Oleobject ClassType of files?

I'm stuck how to determine files' Classtypes needed to use in code to embed these files into a Word document:
Selection.InlineShapes.AddOLEObject ClassType:="AcroExch.Document.11", _
FileName:="C:\Work\Dashbaord & ".pdf", LinkToFile:=False, _
DisplayAsIcon:=False
I need to embed csv, pdf, xlsx and txt files. How I can automatically loop all files in folders and automatically determine the ClassType of each?
In order to insert a file as an OLE Object the file type needs to have an available OLE Server installed on the machine, or it needs to be in a format that the Windows Packager mechanism can "wrap up" into an OLE type. Before you go this route you need to ensure that anyone who tries to work with such a document has corresponding OLE Server software installed on the machine on which the document is opened. Just because the machine that creates an embedded OLE object can do so doesn't mean another machine can work with the result, later on.
OLE Server software will be noted in the Registry. The Microsoft Office applications (Word, Excel, PowerPoint, etc.) are able to function as OLE Servers. In the Registry you'll find corresponding entries such as Word.Document and Excel.Workbook... or AcroExch.Document for PDF files if Microsoft Office and the Adobe Acrobat Reader are installed.
One way to figure out which ClassTypes to use would be to manually insert each file type and inspect the resulting Embed field code.
To look the ClassTypes up in the Registry, something like the following code sample can be used in Word. Word has the function System.PrivateProfileString that wraps up a Windows API call to the Registry. It can be used to retrieve and to write information. (This code does not loop the files in a directory as the question was about how to determine the ClassType. For the sake of simplicity a file extension is hard-coded.)
A file type that does not have an OLE Server won't have a . in the default value of the Registry key. A .txt file, for example, is listed as txtfile. You may have to watch out for some file types; for example on my installation a csv file is listed as Excel.CSV, which may not be what you want...
Sub RetrieveOLEInfo()
Dim fileExt As String
Dim regKey As String
Dim oleServer As String
fileExt = "docx"
regKey = "HKEY_Classes_Root\."
oleServer = System.PrivateProfileString("", regKey & fileExt, "")
'Debug.Print oleServer
If InStr(oleServer, ".") = 0 Then
Debug.Print "Insert as a Package"
Else
Debug.Print "Insert as: " & oleServer
End If
End Sub

Excel VBA - URLDownloadToFile - Data missing in downloaded file

I am using the below code to download an excel file from a url. The URL (which I can not share here) is for a ticketing system. I used the search button in the website to get all open and in progress tickets. After that there is a Export drop down button and from the drop down I selected Excel. The url I used is the code is the url of this Export to Excel button.
The code is exporting the excel file to given path, but there is only the page header and footer data to show the time of download and two lines saying "Displaying 0 issues at 07/Jul/14 3:14 PM." and "No Issues Found". in the file.
If I use the url directly on any website, it opens the file with data. If I use Workbooks.open "myUrl" same blank file is opening.
Can anyone please check what is wrong?
Sub downloadFile()
Test = Dir("C:\Users\" & Environ("username") & "\" & "SearchResult.xls")
If Not Test = "" Then
Kill ("C:\Users\" & Environ("username") & "\" & "SearchResult.xls")
End If
mylink = ""
myresult = 0
mylink = "http://mylink.com/issueviews:SearchResult-excel-all-fields/temp/SearchResult.xls?jqlQuery=status+in+%28Open%2C+%22In+Progress%22%29&tempMax=1000"
myresult = URLDownloadToFile(0, mylink, "C:\Users\" & Environ("username") & "\" & "SearchResult.xls", 0, 0)
If myresult <> 0 Then
MsgBox "Error downloading " & mylink & Chr(10) & Error(myresult)
Else
MsgBox "File has been downloaded"
End If
End Sub
There is not enough information available from the data you have provided.
Basically there is some difference between what happens (on the HTTP protocol query/response level) when you use IE manually and when you run the code.
Typical things are redirecting status codes (see http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection) and missing authentication headers (see http://en.wikipedia.org/wiki/HTTP_header)
If you can not install tools (e.g. cURL) it will be difficult to guess as I don't know what kind of tools you have available.
There are some network diagnostics tools built right into web browsers (in Internet Explorer press F12, in Google Chrome press Ctrl+Shift+I)
(EDIT after comments) You can find what is the exact sequence of http requestes/responses exchanged between the web browser and the web server using the network tab in the browser's built-in developer tools.
Usage instructions for Google Chrome are at https://developer.chrome.com/devtools/docs/network#network-resource-details
Usage instructions for Internet Explorer are at http://msdn.microsoft.com/en-us/library/ie/dn255004(v=vs.85).aspx
Once you'll know what is the right sequence of messages try to reproduce it using cURL.
Once you succeed you can try to reproduce the sequence using Excel VBA functions with similar meaning or you can just call cURL command line tool from Excel as described here: Execute a command in command prompt using excel VBA (or in some of its linked or related questions)

loading csv "Could not find installable ISAM"

Im building a program in Excel VBA to automate a process and I require data stored in a csv file to be imported. So, I'm trying to use a query table to import specific columns in a csv file.
Im using ADO to interface with the csv file using the Jet Provider OLE DB. In the connection string I have specified the provider, data source, and extended properties. Im using windows xp and office 2003, so my Excel version is 8.0. I specified the provider as Microsoft.Jet.OLEDB.4.0. My code is pasted below. When the code executes I get the error "Could not find installable ISAM" at the last line that I included in the below code. I cant find anything wrong with the syntax so I was wondering if this error could be because I dont have the correct version of Jet installed? Please see code below. Thanks
Sub Excel_QueryTable()
Dim oCn As ADODB.Connection
Dim oRS As ADODB.Recordset
Dim ConnString As String
Dim SQL As String
Dim qt As QueryTable
ConnString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\testfile.csv;" & _
"Extended Properties=Excel 8.0;HDR=Yes; FMT=Delimited; IMEX=1"","
Set oCn = New ADODB.Connection
oCn.ConnectionString = ConnString
oCn.Open
Try this:
ConnString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\directory\where\csv\file\is\;" & _
"Extended Properties=""text;HDR=Yes;FMT=Delimited"""
I don't think you want to use the "Excel 8.0" portion, but you aren't actually connecting to an Excel worksheet; you're connecting to a text file. Also, you had extra spaces, and connection strings are REALLY picky about those, so I've deleted them.
Note that you can set the delimiter here:
HKLM\SOFTWARE\Microsoft\Jet\4.0\Engines\Text\Format
Mine is currently CSVDelimited; other options are TabDelimited and Delimited(;)
I found this info at: http://www.connectionstrings.com/textfile
-- EDIT --
Instead of pointing to a specific .csv file, you actually point the data source to a target directory. Note my changes above, in the connection string: the filename has been removed, and the path now ends in a \.
In order to use this type of data source, you actually need to teach the driver how the file is laid out. You do this through the use of a schema.ini file.
You can create the .ini file one of two ways:
Manually edit the file by hand, in notepad, using the above link to provide usage.
Use the tool built into the ODBC Data Source Admin.
In order to use the tool, you need to actually go through the steps of creating a data source. You don't actually need the data source, but as far as I can tell, it's the only way to get to the create schema.ini creation tool.
To get there:
Go to the ODBC control panel.
Add a new DSN, type: Microsoft Text Driver (*.txt, *.csv), click Finish
On "ODBC Text Setup", uncheck Use Current Directory and select the directory where your file lives.
Click on the options button, and click on the Define Format button.
Click on the file that you want to work with, and click "Guess" to get you started, then refine the data types as necessary.
When done, click OK, and you should see a schema.ini file in the directory where your .csv file is. Open it in notepad, and make sure it looks right.
The above connection string should now work correctly, using ONLY the directory where your csv lives, not the full path to the .csv.

Resources