Tôi muốn tạo chương trình bảng điều khiển trong VB.net để cho phép tham số. Những gì tôi muốn làm là trong mã dưới đây thêm các thông số để trang webpart có thể được tạo ra từ trình đơn Run. ví dụ. C: ....... \ MyProgram.exe "Thiết kế" - Điều này sau đó sẽ tạo ra trang Webpart thiết kế.Chương trình dòng lệnh VB.Net (bảng điều khiển) với tham số cho SharePoint
Tôi đã thử xem internet nhưng không thành công lắm. Mọi sự trợ giúp sẽ rất được trân trọng.
Module Main
Public Sub Main(ByVal args As String())
Dim prj As String
Dim site As New SPSite("http://site/")
Dim web As SPWeb = site.AllWebs(0)
Dim list As SPList = web.Lists("ListName")
Dim postInformation As String = "<?xml version=""1.0"" encoding=""UTF-8""?><Method><SetList Scope=""Request"">" + list.ID.ToString + "</SetList><SetVar
Name=""ID"">New</SetVar><SetVar Name=""Cmd"">NewWebPage</SetVar><SetVar
Name=""Type"">WebPartPage</SetVar><SetVar Name=""WebPartPageTemplate"">2</SetVar><SetVar
Name=""Title"">" + prj.ToString + "</SetVar><SetVar
Name=""Overwrite"">true</SetVar></Method>"
Dim processBatch As String = web.ProcessBatchData(postInformation)
'Display the results...
Console.WriteLine(processBatch)
Console.WriteLine("New Web part page added successfully")
Console.ReadLine()
End Sub
End Module
Cảm ơn bạn trước!