Answered by:
How to login programmatically in office 356 with bat file?

Question
-
Hi everybody!
I developed an access application and currently I am working in create a install package with Inno Setup. I decided this way because I am going distribute it to several customers and my application works with some templates, references, pictures... Now, the "access application" is linked to several sharepoint lists, and every time that I copy my app in another computer this doesn't work because it required Office 365 credential. I found some tips helpful in this article:
https://technet.microsoft.com/en-us/library/dn568015.aspx#Step2
But I guess that maybe isn't the better way for solve my trouble, my costumers works with differents Windows versions (7, 8, 10) and according to this post:
http://stackoverflow.com/questions/16018732/msonline-cant-be-imported-on-powershell-connect-msolservice-error
PowrShell works according to Windows version, (at least the "msonline" command)
So my question is: Do you know someway to login programmatically in office 356 with bat file (or anything else) (?)
Thanks for advance!Monday, January 11, 2016 7:23 PM
Answers
-
Hi Davidrsaa,
From the description, it seems you were developing an Access client database which link to the SharePoint lists and you want to distribute the Access database to others.
Based on my understanding, if the SharePoint list need to authenticate before link then the users need to authenticate. You may need to create extra account on SharePoint and assign the correct SharePoint resource permission to those accounts and inform the users the account so that others can visit the SharePoint list in Access.
Here are some helpful links about SharePoint permission:
Manage permissions for a list, library, folder, document, or list itemPermission levels and permissions
If I misunderstood, please feel free to let me know.
Regards & Fei
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- Proposed as answer by Fei XueMicrosoft employee Friday, January 15, 2016 6:32 AM
- Marked as answer by Fei XueMicrosoft employee Thursday, January 21, 2016 7:36 AM
Tuesday, January 12, 2016 2:28 AM -
Hi Davidrsaa,
>>I don't want the user "see" the list or better I don't want to let the user know that he can modify the list in SharePoint Site. Let me explain a bit, my access application does use of "lists" for sharing common information between they (my customers) and I have designed many forms for to handle this information, also I do use of several options in my database like (hide ribbon, hide QAT, Disable Special Keys, Hide tables/list).
When I invite users, They must to verify your account following the attachment link sent at their emails, thereupon the browser opens in sharepoint site and shows everything!<<
The users not able to see the information from the SharePoint until they path through the authenticate for the SharePoint. And you can distribute the different SharePoint user for the different permission(read-only or write to the link list).
There is risk to writing your account and password into a script and distribute it to the end-user. If you want the users get the permission after you verify the account through user's email, you may need to encrypt the email and send the correct account/password to connect the SharePoint.
Hope it is helpful.
Regards & Fei
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- Proposed as answer by Fei XueMicrosoft employee Friday, January 15, 2016 6:32 AM
- Marked as answer by Fei XueMicrosoft employee Thursday, January 21, 2016 7:36 AM
Thursday, January 14, 2016 6:27 AM
All replies
-
I don't, but I may have an idea for a different approach, if it's not "too cumbersome" for you. I can't remember if Access requires the login credentials before the linked table is actually referenced in the application. If so, you might try "deleting" the linked tables and just "recreate" them providing the username and password at that time. It's sort of like a "disconnected recordset" concept.
Just my 2 cents...
Monday, January 11, 2016 7:31 PM -
Hi and thaks the DB guy
Well, I can't understand what do you try to explain me. Let me give you context: My application is done (beta version), I must to distribute it to several customers, but I want automate and do more secure the installation, for this I use Inno Setup (creating a window wizard), I want from there execute some script that login in Office 365, where I have MyLists and one text file with a serial number for download and continue the install.
Can you give me any additional comments?
Note:
I do this because in each computer that I want to install the application, This won't work if they don't have previously entered credentials.
Thanks!
- Edited by Davidrsaa Monday, January 11, 2016 7:57 PM
Monday, January 11, 2016 7:54 PM -
Hi. Sorry for the confusion. I am not familiar with Inno scripting, and if you don't want to use Power Shell, then perhaps you can use VB scripting. Just a thought...Monday, January 11, 2016 8:34 PM
-
Or, if there's a way to publish your list in a "public" site, then you may not need a login for your install.Monday, January 11, 2016 8:36 PM
-
No problem. Do you know how can I use vb script for auto login Office 365 (?) I can't, There are several lists and contain business information.Monday, January 11, 2016 8:48 PM
-
You could try this one. Hope that helps...Monday, January 11, 2016 10:49 PM
-
Hi Davidrsaa,
From the description, it seems you were developing an Access client database which link to the SharePoint lists and you want to distribute the Access database to others.
Based on my understanding, if the SharePoint list need to authenticate before link then the users need to authenticate. You may need to create extra account on SharePoint and assign the correct SharePoint resource permission to those accounts and inform the users the account so that others can visit the SharePoint list in Access.
Here are some helpful links about SharePoint permission:
Manage permissions for a list, library, folder, document, or list itemPermission levels and permissions
If I misunderstood, please feel free to let me know.
Regards & Fei
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- Proposed as answer by Fei XueMicrosoft employee Friday, January 15, 2016 6:32 AM
- Marked as answer by Fei XueMicrosoft employee Thursday, January 21, 2016 7:36 AM
Tuesday, January 12, 2016 2:28 AM -
Hi Fei Xue thanks for your answer! It was really helpful.
I am noob in Sharepoint and I have a very basic knowledge in several utilities yet. Now I want to make other question related with the topic:I don't want the user "see" the list or better I don't want to let the user know that he can modify the list in SharePoint Site. Let me explain a bit, my access application does use of "lists" for sharing common information between they (my customers) and I have designed many forms for to handle this information, also I do use of several options in my database like (hide ribbon, hide QAT, Disable Special Keys, Hide tables/list).
When I invite users, They must to verify your account following the attachment link sent at their emails, thereupon the browser opens in sharepoint site and shows everything!
Can I use a vbscript (or something similar) for to request the user your account and password and automate the step of verify, continuing with things like check serial number... and otherwise installation?
Note:
I found this code for do something similar that I want, but when I run they works 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.
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 NetCommand="net.exe use w: ""https://yourcompany.sharepoint.com/Library 2"" /user:username@yourdomain.com office365password" wShell.Run "cmd.exe /C " & NetCommand, 1, True Set wShell=Nothing objIE.quit Set objIE = Nothing
- Edited by Davidrsaa Wednesday, January 13, 2016 1:15 AM
Tuesday, January 12, 2016 8:58 PM -
Hi David. Is that code from the link I posted? Just curious...Tuesday, January 12, 2016 9:01 PM
-
Exactly that is! the DB guy ,
I forget quote you!
Tuesday, January 12, 2016 9:51 PM -
Hi. No worries. Like I said earlier, I don't use Inno Setup, so I'm hoping you can somehow combine the two techniques to get you to where you need to go. For example, you can try using VBScript to log into SharePoint and Inno Setup to complete the installation. Good luck!Tuesday, January 12, 2016 9:59 PM
-
Yeah! That's point, and although the method seems be that : Using VBScript to log into SharePoint and Inno Setup to complete the installation. I can't find the fail in the code posted, Okey, exactly here, I guess:
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 NetCommand="net.exe use w: ""https://yourcompany.sharepoint.com/Library 2"" /user:username@yourdomain.com office365password" wShell.Run "cmd.exe /C " & NetCommand, 1, True Set wShell=Nothing objIE.quit Set objIE = Nothing
Again thanks for your replies!
Incidentally, in the link I provide my full problem and with more context:
http://stackoverflow.com/questions/34756906/how-to-login-in-office-365-from-vbscript-and-browse-through-sharepoint-with-pasc
- Edited by Davidrsaa Wednesday, January 13, 2016 2:35 AM Add info.
Tuesday, January 12, 2016 10:49 PM -
NOTE:
I consider that maybe this post is in the wrong site, for this reason I decided move it and restructure (according your suggestions) here :
https://social.msdn.microsoft.com/Forums/office/en-US/ed132d5c-51aa-4432-ada7-660b222f7697/how-to-programmatically-auto-login-in-a-sharepoint-site-from-vbscript-?forum=sharepointdevelopmentlegacy#ed132d5c-51aa-4432-ada7-660b222f7697
Many thanks!
PD: I have to close the post in somehow special?
- Edited by Davidrsaa Thursday, January 14, 2016 12:17 AM
Wednesday, January 13, 2016 11:06 PM -
Hi Davidrsaa,
>>I don't want the user "see" the list or better I don't want to let the user know that he can modify the list in SharePoint Site. Let me explain a bit, my access application does use of "lists" for sharing common information between they (my customers) and I have designed many forms for to handle this information, also I do use of several options in my database like (hide ribbon, hide QAT, Disable Special Keys, Hide tables/list).
When I invite users, They must to verify your account following the attachment link sent at their emails, thereupon the browser opens in sharepoint site and shows everything!<<
The users not able to see the information from the SharePoint until they path through the authenticate for the SharePoint. And you can distribute the different SharePoint user for the different permission(read-only or write to the link list).
There is risk to writing your account and password into a script and distribute it to the end-user. If you want the users get the permission after you verify the account through user's email, you may need to encrypt the email and send the correct account/password to connect the SharePoint.
Hope it is helpful.
Regards & Fei
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- Proposed as answer by Fei XueMicrosoft employee Friday, January 15, 2016 6:32 AM
- Marked as answer by Fei XueMicrosoft employee Thursday, January 21, 2016 7:36 AM
Thursday, January 14, 2016 6:27 AM