Hi Drew
I’ve just tried accessing and setting Site Custom fields, and have not have any of the issue you mentioned.
If my test code below doesn’t help you fix your issues can you please post some of your code, mainly the bit where you load the site, access the fields and save it again, And some understanding of what you are trying to achieve with the API could Help us.
Also let us know what the exception is saying when you try to update the custom field, make sure you are calling the correct Set__Value function, there are 4 control types and only one of the Set__Value methods will work for each control type.
The code in Red denotes values specific to my test database only
' Start the Helpmaster API
Dim strMSG As String
HMPAPI = New HelpMasterProAPI.Connection ' Instantiate the HMP API
' This values represent the "staff" To log on to The API as.
' This value is used when things like logged by/ Actioned by are explicitly set.
HMPAPI.LoggedOnUserLink = 5618
' Set the database connection string
HMPAPI.DatabaseConnectionString = "Data Source=(local);Initial Catalog=HMP11Test;Integrated Security=SSPI;Application Name=HelpMaster API;"
strMSG = HMPAPI.StartHelpMasterProAPI() ' Start the API
' Check for any errors during the startup process.
' Any errors will be returned in the string strMSG
If strMSG <> "" Then
MsgBox(strMSG)
HMPAPI.EndHelpMasterProAPI()
HMPAPI = Nothing
Exit Sub
End If
' Load The Site
Dim mySite As New HelpMasterProAPI.Site
mySite.Load(612)
' To List PKIDs of all custom values for Site
Dim strText As String = ""
For Each myCustomField As HelpMasterProAPI.CustomField In mySite.CustomFields
strText += myCustomField.CustomFieldPKID & vbCrLf
Next myCustomField
MsgBox(strText)
' Update a Custom Value For a site
' This pkid 5 must be a pkid for a textbox custom field otherwise the appropriate Set__Value function must be called by the Control Type.
mySite.CustomFields.SetTextBoxValue(5, "123456")
' Save the Updated Custom Value Back to the Site
mySite.Save()
mySite.TearDown()
mySite = Nothing