Hi,
There is an error in your sample program. It should be like this:
CaWHarvest harvest = new CaWHarvest();
int res = harvest.Login("broker", "harvest", "harvest");
Console.WriteLine(res);
CaWContainer container = harvest.GetProjectList();
// CaWStringList stringList = container.GetKeyList();
int projectCnt = container.GetKeyElementCount("CA_ATTRKEY_NAME") - 1;
// for (int i = 0; i <= stringList.GetSize(); i++)
for (int i = 0; i <= projectCnt; i++)
{
CaWData data = container.Props("CA_ATTRKEY_NAME", i);
if (data.GetStringValue().Trim().Length > 0)
Console.WriteLine("Project Name : " + data.GetStringValue());
}
Br
Tomasz Grzmilas
------------------------------
Developer
Delegate
------------------------------
Original Message:
Sent: 10-21-2020 12:05 PM
From: Sridhar Gooni
Subject: Installing Chsdk on Windows 10 and Usage in C# project
Hello Tomasz,
Can you try following sample program?
Following is the sample program which i have used to print project names :
CaWHarvest harvest = new CaWHarvest();
int res = harvest.Login("broker", "harvest", "harvest");
Console.WriteLine(res);
CaWContainer container = harvest.GetProjectList();
CaWStringList stringList = container.GetKeyList();
for (int i = 0; i <= stringList.GetSize(); i++)
{
CaWData data = container.Props("CA_ATTRKEY_NAME", i);
if (data.GetStringValue().Trim().Length > 0)
Console.WriteLine("Project Name : " + data.GetStringValue());
}
Thanks,
Sridhar
Original Message:
Sent: 10-19-2020 09:34 AM
From: Tomasz Grzmilas
Subject: Installing Chsdk on Windows 10 and Usage in C# project
Hi,
I use Windows 10 64 bit version.
I register chsdk.lib from 32 bit installation.
In my program I have:
ICaWHarvest harvest = new CaWHarvest();
var res = harvest.Login("brocker", "user", "login");
I get error
System.InvalidCastException
HResult=0x80004002
Message=Unable to cast COM object of type 'CHSDKLib.CaWHarvestClass' to interface type 'CHSDKLib.ICaWHarvest'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{70107C61-8ABB-11D5-961B-0010A4F73DE4}' failed due to the following error: Bad variable type. (0x80020008 (DISP_E_BADVARTYPE)).
Source=System.Private.CoreLib
StackTrace:
at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, IntPtr& ppTarget, Boolean& pfNeedsRelease)
at CHSDKLib.CaWHarvestClass.Login(String bstrBrokerName, String bstrUserName, String bstrPassword)
Can you tell what is the problem ?
Original Message:
Sent: 08-31-2020 06:33 AM
From: Sridhar Gooni
Subject: Installing Chsdk on Windows 10 and Usage in C# project
Hello Chris,
Can you try copying chsdk.dll and chsdk.lib from 32 bit installation?
The above step should solve your problem.
Thanks,
Sridhar
Original Message:
Sent: 08-26-2020 08:45 AM
From: Christoph Zill
Subject: Installing Chsdk on Windows 10 and Usage in C# project
Hello,
in our company we upgraded to CA Harvest 13.0.3, because we are replacing old Windows 7 systems with newer Windows 10 platforms.
On the old Windows 7 systems we have been using the CA Harvest SDK with the chsdk.dll file. So our setup included the registration of the chsdk.dll file with the the following command:
regsvr32 chsdk.dll
For this to work we had to copy the following files to the C:\Windows\SysWOW64 directory:
chsdk.dll
Hsdk.dll
Hsdk.lib
Hsdk64.dll
Interop.CHSDKLib.dll
In our C# project solution, we referenced the following COM->Type Library:
chsdk 1.0 Type Library
And inside the C# class we used:
using CHSDKLib;
So after upgrading to CA Harvest version 13.0.3, I checked the documentation for the usage of the COM Interface of the SDK:
https://techdocs.broadcom.com/content/broadcom/techdocs/us/en/ca-enterprise-software/business-management/harvest-scm/13-0/apis-and-sdk-reference/use-the-com-interface-of-the-software-development-kit-chsdk.html
And that's where my problem starts. The file chsdk.dll no longer exists. I found chsdk64.dll in the installation directory, but not any of the files
I used under Windows 7. I registered chsdk64.dll, but I could not find any COM->Type Library to include in my project. Having gone through the documentation provided, I could not find any help or more detailed instruction on how to do this. So hopefully somebody here can help me or point me in the right direction.
------------------------------
Best Regards
Christoph
------------------------------