×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

How to login in Office 365 from VBScript and browse through sharepoint with pascal script(?)

How to login in Office 365 from VBScript and browse through sharepoint with pascal script(?)

How to login in Office 365 from VBScript and browse through sharepoint with pascal script(?)

(OP)
Hi everybody!

I'm packing an Access application, This is connecting with a Sharepoint site. I'm using Inno Setup (With Pascal Scripts) for create an install package. So,
I found this code for do something similar to that I want, when I run the code seems work fine: Open the browser, goes to Office 365, puts information (account and password), but just in the moment when open the cmd and after few seconds, all closes without finish the process.

CODE --> vbscript

On Error Resume Next

Const PAGE_LOADED = 4

Set objIE = CreateObject("InternetExplorer.Application.1")
Call objIE.Navigate("https://yourdomain.sharepoint.com")

objIE.Visible = True

Do Until objIE.ReadyState = PAGE_LOADED : Call WScript.Sleep(500) : Loop

objIE.Document.all.Login.Value = "username@yourdomain.com"
objIE.Document.all.Passwd.Value = "office365password"
objIE.Document.all.persist.checked=True

'The "Submit" button needs to be "clicked" twice in order to sign the user in
' * It appears that some javascript needs to take place behind the scenes to properly initiate the logon
Call objIE.Document.getElementById("cred_sign_in_button").click
Call objIE.Document.getElementById("cred_sign_in_button").click

WScript.Sleep(4000)

Do Until objIE.ReadyState = PAGE_LOADED : Call WScript.Sleep(500) : Loop

Set wShell=CreateObject("WScript.Shell")

NetCommand="net.exe use p: ""https://yourcompany.sharepoint.com/Library 1""  /user:username@yourdomain.com office365password"
wShell.Run "cmd.exe /C " & NetCommand, 1, True

Set wShell=Nothing

objIE.quit

Set objIE = Nothing 

Seems to maybe can be here:

CODE --> vbscript

Set wShell=CreateObject("WScript.Shell")

NetCommand="net.exe use p: ""https://yourcompany.sharepoint.com/Library 1""  /user:username@yourdomain.com office365password"
wShell.Run "cmd.exe /C " & NetCommand, 1, True 


My final aim is do the all process of login in the backstage (for code), create the connexion with 365 via (VBScript (?)), providing the credentials in the script, thereupon go a list in sharepoint site, title: (Serial Numbers(?)) where I Have a list with several numbers and checkboxes for to mark true in every install and avoid use the same number two times.

Thanks for advance!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close