vbscript - Allow uploaded SharePoint files to be marked as "Checked-In" -
I just wrote a VBSPTP that uploads files to a shared folder. It works. The problem is that the default status of these files is "check out" so manually select these files "check in" on the front-end. It is my belief that defeated the purpose of my script is there a way around it? Any kind of help would be greatly appreciated. Thank you. Jake
P.S. Here is a sample code. Set
url = "http: // portal / projects /" objXMLHTTP = CreateObject ("Msxml2.ServerXMLHTTP.3.0") objADOStream = CreateObject ("ADODB.Stream") of ObjADOStream with. open. Type = 1 Load Framefile ("C: \ VBScripts \ SP \ 2014_Test_IC.txt") with termination content = objADOStream. Read objXMLHTTP.open "PUT", URL & amp; "2014_Test_IC.txt", Wrong, "Username", "Password" objXMLHTTP.send Content WScript.Echo objXMLHTTP.status & amp; ":" & amp; ObjXMLHTTP.statusText objADOStream.Close
This can be done using Front Page Server Extensions
The official document for the check in the document method is here:
There is a code here to upload and then check in the document. This is very similar to you and you can finally see that when you call the upload function you will fill in your values. form code string set to String = Create object ("ADODB.Stream") stream.Open stream.Type = 2 '' adTypeText stream.Charset = "ascii" stream.WriteText str stream (SourcePath, siteUrl, docName, title, checkincomment, userName, password) strHeader = "method = put + document%. 3a12.0.4518.1016 "+ _" and service_name =% 2f "+ _" and document = [document_name = "+ escape (docName) + _"; meta_info = [vti_title% 3bSW% 7c "+ escape (title) +" ]] "+ _" And put_poption = overwrite, builder, migrations "+ _" and comment = "+ _" & Keep 5% checked% 5fout = false "+ vbLf bytearray = Set StringToByteArray (strHeader) stream = CreateObject (" ADODB.Stream ") stream. Open the stream. Type = 1 '' adTypeBinary stream. Type Bytere Set Stream 2 = CreateObject ("ADODB .stream") stream 2. Open stream 2. Type = 1 '' addyubayary stream 2. LoadFormFile SourcePath Stream 2 Copy stream, 1 stream. Set page = 0 xmlHttp = CreateObject ("MSXML2.XMLHTTP") xmlHttp.open "POST", siteUrl + "/_vti_bin/_vti_author.dll", false, username, password xmlhttp.setRequestHeader "content type", " Application / x-Vermeer-urlencoded "xmlhttp.setRequestHeader" x-Vermeer-content-type "," application / x-vermeer-urlencoded "xmlhttp.setRequestHeader" user-agent "," frontpage "xmlHttp.send stream if xmlHttp.status = 200 then if Instr (xmlHttp.responseText, "Successfully") = 0 then MsgBox "Error:" & amp; ; VbCrLf & amp; XmlHttp.responseText other '' checkin strHeader = "method = checkin + document% 3a12.0.4518.1016" + _ "and service_name =% 2f" + _ "and document_name =" & amp; Escape (DOCNAME) + _ "& amp; Comment =" + + + "& amp; keep% 5fchedcked% 5fout = false" + vbLf set xmlhttp = CreateObject ("MSXML2.XMLHTTP") xmlHttp.open "Post ", Site URL +" /_vti_bin/_vti_aut/author.dll ", Wrong, Username, Password xmlhttp.setRequestHeader" Content Type "," App / X-worker-URLXode "xmlhttp.setRequestHeader" X-word-content-type "," Application / x-worker-urlencoded "xmlhttp.setRequestHeader" user-agent "," frontpage "xmlHttp.send strHeader end if end if xmlHttp.status / 100 & lt; & Gt; 2 then MsgBox "Error: Status =" & amp; XmlHttp.status & amp; VbCrLf & amp; XmlHttp.responseText expires if end all upload file "c: \ user \ myusername \ desktop \ test file.zip", _ "http: // computername / sites / sitename", _ "requirements / test file.zip", _ "test I have to give credit to fmunkert to do this job: "check", "check", "check my checklist", "mydname \ myusername", "mypassword" messagebox " >
Comments
Post a Comment