You can use a scripting method to create a new article setting all parameters and without displaying a dialog box.
The article is created by means of workflow wf_articlenew.
'Create an article calling the wf_articleNew 'Specify either the destination folderId or path, and regionId or regionpath in the form title:region 'When using folder path, set folderId = 0; the same for regionId. 'When using folder id, set folderpath to "; the same for regionpath 'the typesAndFormatStr specifies the elements and related text format to assign, adn should be formatted as a series of: '[name_of_the_element|name_of_the_format] for example: [head|head36][body|bodyNews][photo_caption|caption] 'sample call: ' dim errmsg as string = "" ' silent call, error will be in errmsg ' ArticleNew("btNews0411",0, "/system/users/reba", "Default",0, "Daily:Print", "[head|DE Head 50pt W][body|briefs]", errmsg)
Public Shared Function ArticleNew(ByVal articleName As String, ByVal folderId As Integer, ByVal folderPath As String, _ ByVal typographyName As String, ByVal regionId As Integer, ByVal regionPath As String, _ typesAndFormatStr As String, allowOverwrite As Boolean, ByRef errMsg As String) _ As Integer Dim pars As New System.Collections.Specialized.NameValueCollection() pars.Add("typographyName", typographyName) If folderId > 0 Then pars.Add("folderId", CStr(folderId)) Else pars.Add("folderPath", folderPath) End If If regionId > 0 Then pars.Add("regionId", CStr(regionId)) Else pars.Add("regionPath", regionPath) End If pars.Add("artName", articleName) pars.Add("typesAndFormatStr", typesAndFormatStr) pars.Add("allowOverwrite", CStr(allowOverwrite)) Dim result As GNClient.Result = DataConnection.Instance.ClientLogin.WorkflowExec("articleNew", Nothing, pars, Nothing) If result.Error Is Nothing Then Dim articleId As Integer = result.WFResult.ImportResults.Item(0).ObjectId App.RaiseInternalAlert(GNClient.TriggerCause.Create, "article", articleId) Return articleId Else If errMsg = "" Then errMsg = result.Error.Message MsgBox(errMsg, MsgBoxStyle.Critical, "Error") End If Return 0 End If End Function |