Convert ActionSiteID to uint

(imported topic written by rem_it)

Hi all,

I am using BES Platform API ImportFile and ImportAction functions. The siteID for action site is -1995328322 but ImportAction takes unsigned int for siteID. Anyone know a workaround to this problem?

I am connecting to COM in Java using a COM-Java bridge which makes it even more difficult because Java does not have the type unsigned int.

I came across this post, but it doesn’t really help much in my case.

https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14747793&#14747793

Thanks!

(imported comment written by SystemAdmin)

ImportAction takes a Site ID for the site of the Fixlet this action is sourced from.

So if you were creating an action from a Fixlet in Updates for Windows Applications you would need to get the ID of the Fixlet and Site. The Site ID can be acquired in the Console under the Manage Sites folder on the left side. If you right-click the header bar of the list you can select ID as a column to display.

With that ID and the Fixlet ID you can call:

ImportAction( actionXML, targetXML, patchSiteID, patchFixletID, user, password, actionID );

There really shouldn’t be a need to use the ActionID for anything specifically. I think you might be able to use a ‘long’ in place of an ‘unsigned int’ to help with that problem.

(imported comment written by Bhushan Chirmade)

You can get the site ID from the masthead file(X-Fixlet-Site-Serial-Number) and use the following vbscript code to convert it to required format:

Dim hexnum, hexSiteIdInStr, count

hexnum= Hex(bfSiteId)

hexSiteIdInStr = CStr(hexnum)

If len(hexnum) < 8 Then

For count = len(hexnum) to 7

If count = 7 Then

hexSiteIdInStr = “8” + hexSiteIdInStr

Else

hexSiteIdInStr = “0” + hexSiteIdInStr

End If

Next

End If

SiteID = CLng("&h" & hexSiteIdInStr)

SiteID is the one you are looking for.

Regards,

Bhushan

(imported comment written by Lee Wei)

In case this helps someone, the C# code that I use is as follows.

uint SiteIdU; 
// The original unsigned SiteID that we got usually from Session Relevance String SiteIdInHex = Convert.ToUInt64(SiteIdU).ToString(
"X"); 

int SiteId = Int32.Parse(SiteIdInHex, System.Globalization.NumberStyles.HexNumber); : : BESFixlet.Load(SiteId, FixletId, Username, Password);

Lee Wei

(imported comment written by Bhushan Chirmade)

More information:

https://www.ibm.com/developerworks/forums/thread.jspa?threadID=419506&tstart=15

Regards,

Bhushan