Anyone had any success creating News Items via LAPI (VB version)?
LL_CreateObjectEx works great for Documents, Folders, ..even Channels! ... but whenever I try to create a News Item I get a 'Container Error'.
Code Snippet follows...
------------------------
LL_CreateObjectEx works great for Documents, Folders, ..even Channels! ... but whenever I try to create a News Item I get a 'Container Error'.
Code Snippet follows...
------------------------
Code:
Call LL_ValueAlloc(aCreateInfo) ' The assoc val for the Creation Info
Call LL_ValueSetAssocInArgs(aCreateInfo)
Call LL_ValueAlloc(aRequest) ' The assoc val for the Request info
Call LL_ValueSetAssocInArgs(aRequest)
Call LL_AssocSetValue(aCreateInfo, "Request", aRequest) ' & attach the Request Assoc
' **** Now fill in the fields in the aRequest Assoc with the data required to create the News Item
'News:
'Key Value Type Value Description
'_________________________________________________
'Story String the text containing the body of the news item
'DateEffective Date a value object of type Date specifying the date
' on which the news item becomes effective
'DateExpiration Date a value object of type Date specifying the
' date on which the news item expires
'Headline String the text representing the title of the news item
'IMG_ID Integer the object ID of an image (*.gif) file associated with
' the news item
'Comment String the comments associated with the news item
Call LL_AssocSetString(aRequest, "Story", objNewsItem.Body)
Call LL_AssocSetDate(aRequest, "DateEffective", MakeCDate(Now()))
Call LL_AssocSetDate(aRequest, "DateExpiration", MakeCDate(DateAdd("d", 5, Now())))
Call LL_AssocSetString(aRequest, "Headline", objNewsItem.Summary)
Call LL_AssocSetInteger(aRequest, "IMG_ID", 0)
Call LL_AssocSetString(aRequest, "Comment", "This is the Comment text")
' Now ensure we have a Unique Name for the News Item...
Call LL_ValueAlloc(aNodeInfo)
Call LL_ValueSetAssocInArgs(aNodeInfo)
Call LL_ValueAlloc(vName)
Call LL_AssocSetString(aNodeInfo, "Name", objNewsItem.Title)
Call LL_AssocSetInteger(aNodeInfo, "SubType", LL_NEWSSUBTYPE)
status = LL_GetUniqueObject(m_lSession, VolID, objNewsItem.ChannelID, aNodeInfo, vName)
If status <> LL_OK Then
LL_ErrorMsg m_lSession, "Getting Unique name for " & objNewsItem.Title
CreateNewsItem = -1
GoTo Exit_CreateNewsItem
End If
Call LL_ValueGetString(vName, sBuffer, 256, BUFSIZ)
sUniqueName = Left(sBuffer, BUFSIZ)
'Long LL_CreateObjectEx( _
' ByVal session as Long, _
' ByVal parentVolID as Long, _
' ByVal parentID as Long, _
' ByVal objType as Long, _
' ByVal objSubType as Long, _
' ByVal name as String, _
' ByVal createInfo as Long, _
' ByVal objectInfo as Long )
' Now create the Object...**** ALWAYS FAILS WITH A 'Container Error' *************
status = LL_CreateObjectEx(m_lSession, _
ChannelVolID, _
objNewsItem.ChannelID, _
LL_OBJECTTYPE, _
LL_NEWSSUBTYPE, _
sUniqueName, _
aCreateInfo, _
m_TempObject)
If status <> LL_OK Then
LL_ErrorMsg m_lSession, "Creating News Item: " & objNewsItem.Title
CreateNewsItem = -1
GoTo Exit_CreateNewsItem
End If