Hi,
I would like to create a console program in VB.net that would allow parameters. What i would like to do is in the code below add parameters so the webpart page can be created from the Run menu. e.g. C:.......\MyProgram.exe "Design" --This would then create the Design webpart page.
I tried looking at the internet but was not very successfull. any help would be greatly appreciated.
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
Thanks in advance!