國內需求,我們必須讓我們開發系統表單副本到WSS 3.0日曆列表 簡單的說,我知道需要使用ADO來更新[Alluserdata]這個表並且知道whitch tp_listId。如何將數據寫入現有Sharepoint 2007日曆列表
但是,更新,已經寫入數據庫之後,它不能出現在Sharepoint頁 我是什麼做一些事情錯了... PS:懷疑tp_size區域關聯,但不知道....
Public Sub Pm_woToSharePoint(ByVal PM_WO_MAIN_VIEWRow As PM_WO_MAIN_VIEW)
Try
Dim cdataobj As New cDataACCESS
Dim dt_Prolist As Data.DataTable
Dim selectString As String
selectString = "select top 1 * from AllUserData where tp_listId='4C0516DB-B090-4740-A0F0-B99E6DC31C0C' order by tp_id desc"
dt_Prolist = cdataobj.sqlDt(selectString, "SharepointConnectionString")
Dim CalenderListRow As Data.DataRow = dt_Prolist.NewRow
Dim CalenderListRow2 As Data.DataRow = dt_Prolist.Rows(0)
With CalenderListRow2
CalenderListRow.Item("tp_ID") = .Item("tp_id") + 1
CalenderListRow.Item("tp_ListId") = .Item("tp_ListId")
CalenderListRow.Item("tp_SiteId") = .Item("tp_SiteId")
' CalenderListRow.Item("tp_RowOrdinal") = 0
CalenderListRow.Item("tp_Version") = 1
CalenderListRow.Item("tp_Author") = 96
CalenderListRow.Item("tp_Editor") = 96
CalenderListRow.Item("tp_Modified") = Now
CalenderListRow.Item("tp_Created") = Now
CalenderListRow.Item("tp_Ordering") = DBNull.Value
CalenderListRow.Item("tp_ThreadIndex") = DBNull.Value
' CalenderListRow.Item("tp_HasAttachment") = 0
'CalenderListRow.Item("tp_ModerationStatus") = 0
CalenderListRow.Item("tp_IsCurrent") = 1
CalenderListRow.Item("tp_ItemOrder") = 100 * CalenderListRow.Item("tp_ID")
CalenderListRow.Item("tp_InstanceID") = DBNull.Value
' CalenderListRow.Item("tp_GUID") = 4
' CalenderListRow.Item("tp_CopySource") = DBNull.Value
'CalenderListRow.Item("tp_HasCopyDestinations") = DBNull.Value
CalenderListRow.Item("tp_AuditFlags") = DBNull.Value
CalenderListRow.Item("tp_InheritAuditFlags") = DBNull.Value
CalenderListRow.Item("tp_Size") = .Item("tp_Size")
CalenderListRow.Item("tp_WorkflowVersion") = 1
CalenderListRow.Item("tp_WorkflowInstanceID") = DBNull.Value
CalenderListRow.Item("tp_DirName") = .Item("tp_DirName")
CalenderListRow.Item("tp_LeafName") = CStr(CalenderListRow.Item("tp_ID")) & "_.000"
CalenderListRow.Item("tp_DeleteTransactionId") = .Item("tp_DeleteTransactionId")
CalenderListRow.Item("tp_ContentType") = .Item("tp_ContentType")
CalenderListRow.Item("tp_ContentTypeId") = .Item("tp_ContentTypeId")
CalenderListRow.Item("nvarchar1") = PM_WO_MAIN_VIEWRow.ITEM_NAME & " " & PM_WO_MAIN_VIEWRow.ITEM_VALUE
CalenderListRow.Item("nvarchar3") = PM_WO_MAIN_VIEWRow.ST_NAME_CHT
CalenderListRow.Item("ntext2") = "機臺:" & PM_WO_MAIN_VIEWRow.MS_NAME_CHT & " 生產人員:" & PM_WO_MAIN_VIEWRow.ProductPerson
CalenderListRow.Item("datetime1") = DateAdd(DateInterval.Hour, -8, CType(PM_WO_MAIN_VIEWRow.START_TIME, DateTime))
CalenderListRow.Item("datetime2") = DateAdd(DateInterval.Hour, -8, CType(PM_WO_MAIN_VIEWRow.END_TIME, DateTime))
CalenderListRow.Item("int1") = 0
' CalenderListRow.Item("int2") = .Item("int2")
CalenderListRow.Item("bit1") = 0
CalenderListRow.Item("bit2") = 0
CalenderListRow.Item("bit3") = 0
CalenderListRow.Item("tp_Level") = 1
CalenderListRow.Item("tp_IsCurrentVersion") = 1
CalenderListRow.Item("tp_UIVersion") = 512
CalenderListRow.Item("tp_CalculatedVersion") = 0
CalenderListRow.Item("tp_UIVersionString") = "1.0"
CalenderListRow.Item("tp_DraftOwnerId") = DBNull.Value
CalenderListRow.Item("tp_UIVersionString") = DBNull.Value
CalenderListRow.Item("tp_CheckoutUserId") = DBNull.Value
End With
dt_Prolist.Rows.Add(CalenderListRow)
cdataobj.ExecSQL(dt_Prolist, selectString, "SharepointConnectionString")
Catch ex As System.Exception
Throw
End Try
End Sub
爲什麼你直接訪問,而不是使用SharePoint API的SharePoint數據庫,?!?這真是**糟糕**的想法。 – 2011-06-15 07:15:07