Powershell - Sharepoint Online OneDrive Users

I've been trying to use a script to find Users and the amount of data that is being used within OneDrive.One of my colleagues made the following script which works a treat:PowershellImport-Module Microsoft.Online.SharePoint.Powershell$Output = "c:\source\Onedrive-Output.csv"#Specify tenant admin and URL$cred = Get-Credential$TenantURL = "https://-admin.sharepoint.com"$pattern = '[^a-zA-Z]'#Configure Site URL and User$SiteURL = "https://-my.sharepoint.com"Connect-SPOService -Url "https://-admin.sharepoint.com" -Credential $cred#Add references to SharePoint client assemblies and authenticate to Office 365 site - required for CSOMAdd-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\...
This topic first appeared in the Spiceworks Community

I've been trying to use a script to find Users and the amount of data that is being used within OneDrive.One of my colleagues made the following script which works a treat:PowershellImport-Module Microsoft.Online.SharePoint.Powershell$Output = "c:\source\Onedrive-Output.csv"#Specify tenant admin and URL$cred = Get-Credential$TenantURL = "https://-admin.sharepoint.com"$pattern = '[^a-zA-Z]'#Configure Site URL and User$SiteURL = "https://-my.sharepoint.com"Connect-SPOService -Url "https://-admin.sharepoint.com" -Credential $cred#Add references to SharePoint client assemblies and authenticate to Office 365 site - required for CSOMAdd-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\...
This topic first appeared in the Spiceworks Community

Similar Messages

  • SharePoint Online External Users

    So I was taking SharePoint online for a test drive a few days ago. While I was looking at how users are given permissions to list and libraries I realize something that might
    make or break SP Online for me. The out-of-the-box SharePoint Online implementation gives you one private site collection and one public website. Let just focus on the public website in this example. Now, by default the public website is at least viewable
    to everyone. But what if I created a survey on my public website and only wanted members of the site to have access to it. I know that you can "Share Site" with external users. But can you allow visitors to your site the ability to create their own account,
    and in turn fill out the survey? And of course without purchasing a license for every person filling the survey.
    Jeffrey T McFarland

    I'm not sure about making content on your public site private, but you can make content on your private sites public.  You basically turn on external users for the entire Office 365 SharePoint Online account.  Then you can optionally disable it
    for certain site collections.  That way, you can control who has access to what.  This article might be helpful in explaining how external users works in SharePoint Online: 
    http://office.microsoft.com/en-us/sharepoint-online-enterprise-help/share-a-site-with-external-users-HA102476183.aspx

  • Managed property in a site collection (powershell - SharePoint online)

    Link to my site collection -> https://web.domain.com/sites/SC/_layouts/15/listmanagedproperties.aspx?level=sitecol
    when opening an url similar to this one and filter on a property name refinablestring00
    What I need is to is to add a mapping to do is to add a mapping
    Mappings to crawled properties
    With powershell.
    Assume that a full crawl has finished. That all crawled properties exist.
    I want to add "ows_GoPro_x0020_Code" and I also want to change the Alias to "ProjectNumber"
    What is the best way to do this via powershell for SharePoint 2013 online?
    Do I need to build a sandboxed solution for this?

    HI,i would recommend  run the PowerShell cmdlet to check if this website exists. Here are the detailed steps:
    1. Set up the SharePoint Online Management Shell Windows PowerShell environment
    http://technet.microsoft.com/en-us/library/fp161372.aspx
    2. Run the command Get-SPOSite, it will return all site collections.
    3. Check if the problematic public site collection is shown in the result. If it shows up, run another command to remove it. For example:
    Remove-SPOSite -Identity https://expertsharepoint/sites/site1 -NoWait
    This will remove the site collection named https://expertsharepoint/sites/site1 from the site collections list and moves it to the Recycle Bin.
    4. Delete the site from the Recycle Bin:
    Remove-SPODeletedSite -Identity https://expertsharepoint/sites/site1
    Anil Avula[MCP,MCSE,MCSA,MCTS,MCITP,MCSM] See Me At: http://expertsharepoint.blogspot.de/

  • Custom web part in SharePoint Online for "User segments"

    Hi Experts,
    I was refferd here from the SharePoine Online community. http://community.office365.com/en-us/f/148/p/278071/851153.aspx 
    I was following this article to implement user segment in SharePoint Online http://blogs.msdn.com/b/adaptive_experiences_in_sharepoint_2013/archive/2012/11/14/set-up-user-segmentation-to-drive-adaptive-experiences-in-a-product-catalog-in-sharepoint-2013.aspx 
    However, this seems to require a custom web part to be build and deployed in SharePoint Online.
    Anyone has made user segment work in SharePoint Online? Anyone has done this custom web part before?
    Thank you,
    Aswath NS

    By default the Site Users web part shows all the users and groups who have been give direct permission to the site.  That would not include anyone who was given permission by being added to a group.  You can modify the web part settings to show
    a list of people in the Members group of the site or any other specific group.  But there is no setting to show all the users who have access.
    Paul Stork SharePoint Server MVP
    Principal Architect: Blue Chip Consulting Group
    Blog: http://dontpapanic.com/blog
    Twitter: Follow @pstork
    Please remember to mark your question as "answered" if this solves your problem.

  • Remove "Shared with Everyone" folder from OneDrive/Sharepoint Online

    Due to security concerns, we want to get rid of the "Shared with Everyone" folder our entire user-base (which is around 1800). Is there an automated way of removing it from SharePoint Online permissions or a PowerShell script?

    Hi
    Unfortunately, there isn't a way to remove the "Shared With Everyone" folder for all users. As
    an admin, you can just log into every user's OneDrive for business library to delete it one by one. Sorry for this. If the amounts of the users are large, it will take heavy workloads to work on this. In this situation, we suggest you let the users delete
    the folder by themselves.
    Amit Kotha

  • The underlying connection was closed: An unexpected error occurred on a receive..Exception.Message - while executing powershell command for sharepoint online site

    " +The underlying connection was closed: An unexpected error occurred on a receive..Exception.Message " OR sometimes
    "The remote server returned an error: (503) Server Unavailable..Exception.Message"
    Getting exception above when performing various operation (site coll creating, group creation, adding users to group) for sharepoint online (Office 365) site using powershell script.
    I want to create 3500 site collections using PS script. In-between getting above exception so it will skip one site collection creating and working again. for eg. after creating 11 site coll, script will through above exception and so 12th site coll will
    not be create but working fine from 13 and so on...

    Remote server seems working to me...any additional check?
    if problem with remote server then may be loop to create site provisioning should not start again..Right?
    any idea?

  • How to set up Sharepoint Online and OneDrive for business like shared path in local network

    Hi!
    I need to create in OneDrive for business or Sharepoint Online shared folder with documents that would be visible to all selected employees or all employees of the selected group.
    How to make it through the admin panel of Office 365, not by creating a folder in any user's access and send invitations to each user by email?

    Do you mean you want to map OneDrive for Business as a network drive? If so have a look at this technical article
    http://support.microsoft.com/en-us/kb/2616712
    Myles Jeffery | Thinkscape Limited
    Try mapping OneDrive for Business and team site libraries to network drives with Zee Drive, its easy!
    Try our file share migration tool for OneDrive for Business and SharePoint Online Office 365

  • Having trouble uploading sub folders to Sharepoint online using PowerShell

    Hi there,
    I have been attempting to upload folders and files to a document library on Sharepoint Online. I can upload the top-level folder and the files in that folder but when i comes to the sub folders i get this message: 
    New-Object : Exception calling ".ctor" with "2" argument(s): "Access to the path 
    'C:\FilePath\TestFolder\TestFolder1' is denied."
    At C:\FilePath\ImportFiles_Test1.ps1:54 char:29
    +               $FileStream = New-Object IO.FileStream($File.FullName,[System.IO.F ...
    +                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [New-Object], MethodInvocationException
        + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand
    I'm running as an Administrator so I have full access to the folders
    here's my code so far
    #Specify tenant admin and site URL
    $User = "[email protected]"
    $SiteURL = "https://company.sharepoint.com/sites/TestSite"
    $Folder = "C:\Users\user\Documents\SharepointTestFolder"
    $DocLibName = "Admin"
    #Add references to SharePoint client assemblies and authenticate to Office 365 site - required for CSOM
    Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"
    Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
    $Password = Read-Host -Prompt "Please enter your password" -AsSecureString
    #Bind to site collection
    $Context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
    $Creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($User,$Password)
    $Context.Credentials = $Creds
    #Retrieve list
    $List = $Context.Web.Lists.GetByTitle($DocLibName)
    $Context.Load($List)
    $Context.ExecuteQuery()
    Function ImportFiles()
    #Get name of folder
    $NewFolder = Split-Path $Folder -Leaf
    #upload folder to sharepoint
    $UploadFolder = $List.RootFolder.Folders.Add($NewFolder) #this may not upload folders within folders.
    $Context.Load($UploadFolder)
    $Context.ExecuteQuery()
    $FilesInFolder = Get-ChildItem $Folder | ? {$_.PsIsContainer -eq $False}
    #Loop Through Folder
    Foreach ($File in (dir $Folder))
    #If file
    If($File)
    #Upload file to Sharepoint
    $FileStream = New-Object IO.FileStream($File.FullName,[System.IO.FileMode]::Open)
    $FileCreationInfo = New-Object Microsoft.SharePoint.Client.FileCreationInformation
    $FileCreationInfo.Overwrite = $true
    $FileCreationInfo.ContentStream = $FileStream
    $FileCreationInfo.URL = $File
    $Upload = $UploadFolder.Files.Add($FileCreationInfo)
    $Context.Load($Upload)
    $Context.ExecuteQuery()
    Else
    recurse ImportFiles
    ImportFiles
    If anyone could help me I'd be so grateful!!
    Thanks!!
    Dearbhla Bradley

    The exception is pretty clear. for some reason the script is not able to open the folder TestFolder1 on the local hard drive.
    I noticed in the script you have specified the $Folder variable to be "C:\Users\user\Documents\SharepointTestFolder" while the exception is for "C:\FilePath\TestFolder\TestFolder1"
    Will you please help me understand this difference?
    Also, sorry I'm not familiar with the "recurse" calling method. I'm suspecting you're telling it to call the ImportFiles() function again, though if this is the case it looks to me that it's reusing the same $Folder variable that was defined at the start,
    rather than using the folder object you have just identified.
    Jason Warren
    @jaspnwarren
    jasonwarren.ca
    habaneroconsulting.com/Insights

  • Powershell CSOM Sharepoint online list permission

    I've been writing a script to connect to SharePoint online, create a document library and add some AD accounts to the permission. I've written all the code using snippets I have found through many searches but am having an issue with the permissions part.
    All of the code is taken from this page:
    http://jeffreypaarhuis.com/2012/06/07/scripting-sharepoint-online-with-powershell-using-client-object-model/
    The only change is i'm using the get principal fun instead of the get group, but not sure if that's what has done it. I'm very new to powershell.
    I keep getting an error when adding the user and permission type to roledefinitionbinding. The error is:
    Collection has not been initialized at line 0 char 0.
    The issue is when it runs $collRoleAssign.Add($principal, $collRdb) part and stop with the error above.
    I would really appreciate a hand with this before my PC get launched out of the window.
    Thanks Mark

    Hi,
    The following code snippet for your reference:
    var login = "[email protected]";
    var password = "xxxxxx";
    var siteURL=”https://SharePointOnlineSiteUrl”;
    ClientContext ctx = new ClientContext(siteURL);
    var securePassword = new SecureString();
    foreach (char c in password)
    securePassword.AppendChar(c);
    SharePointOnlineCredentials credentials = new SharePointOnlineCredentials(login, securePassword);
    ctx.Credentials = credentials;
    Web wsite = ctx.Web;
    ctx.Load(wsite, w => w.HasUniqueRoleAssignments, w => w.RoleAssignments.Include(roleAssigned => roleAssigned.Member.Title,
    roleAssigned => roleAssigned.RoleDefinitionBindings.Include(roleDef => roleDef.Name)));
    ctx.ExecuteQuery();
    RoleAssignmentCollection rac = wsite.RoleAssignments;
    if (rac != null && rac.Count !=0)
    Console.WriteLine("Unique Permissions: " + wsite.HasUniqueRoleAssignments);
    foreach (RoleAssignment ra in rac)
    Console.WriteLine("Group Name: " + ra.Member.Title);
    foreach (RoleDefinition rd in ra.RoleDefinitionBindings)
    Console.WriteLine("Permission: " + rd.Name);
    Console.ReadKey();
    More information:
    http://social.technet.microsoft.com/wiki/contents/articles/24087.associate-permission-levels-with-sharepoint-user-groups-using-the-client-side-object-model-in-netc.aspx
    Thanks,
    Dennis Guo
    TechNet Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Dennis Guo
    TechNet Community Support

  • Create new User Account in sharepoint online

    I am trying to create a webpart (C#)  to allow a user to create an account in sharepoint online (office 365). I thought there would be some type of web-service I could use to do this but so far no luck. I tried sharepointemailws.asmx but that didn't
    work. There has to be a way that this can be done in C#, does anyone know? Help!

    As you can use the New-MsolUser PowerShell cmdlet there must be a web service there. These might not be documented yet. You might try using Fiddler and see what PowerShell is sending.
    Mike Smith TechTrainingNotes.blogspot.com
    my SP customization book

  • Not able to set security group without mail enabled as site collection admin using powershell in sharepoint online site - office 365

    not able to set security group without mail enabled as site collection admin using powershell in sharepoint online site - office 365?
    Any idea?

    after few days test in my lab, I can see that only email enabled group can be added as site collection admin using POWERSHELL.
    hope this helps who stuck like me!! :-)

  • We have a long list of disabled/deleted users in AD Somehow, they are still appeared as active user in Sharepoint Online. How do we get rid of those list? Hope you can advice. Thanks.

    we have a long list of disabled/deleted users in AD
    Somehow, they are still appeared as active user in Sharepoint Online.
    How do we get rid of those list?
    Hope you can advice. Thanks.

    SharePoint does not remove users from SharePoint permissions just because they were deleted/disabled in AD. This is to maintain referential integrity. In fact, when you delete a user from SharePoint, that user remains in the SharePoint content database,
    just marked as deleted.
    They do not have access to SharePoint given their account is deleted/disabled. But as far as automatically managing this, I'm not aware of a tool. On-prem there is Metalogix ControlPoint which does a great job of this, I haven't explored the O365 options.
    Trevor Seward
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • How can i add a special user to the "site collection administrators" of the personal site on sharepoint online when the personal site is creating ?

    when a new personal site is created on the sharepoint online 2013, then the administrator of this personal site will be himself. we can add another person to the "site collection administrators", then this person have full control of this personal
    site.
    but my request is : add this personal to the personal site when the personal site is creating, but not after the personal site has created ?
    Is anybody know how to do that?

    Hi,
    According to your post, my understanding is that you want to add a special user to the "site collection administrators" of the personal site on sharepoint online when the personal site is creating.
    Per my knowledge,
    there is no out of the box way to accomplish this with SharePoint.
    This is a forum which is supported for SharePoint On-Premise.
    Regarding SharePoint Online, for quick and accurate answers to your questions, it is recommended that you initial a new thread in Office 365 forum.
    Office 365 forum
    http://community.office365.com/en-us/forums/default.aspx
    Thanks,
    Linda Li                
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Linda Li
    TechNet Community Support

  • Is it possible to restrict access to individual SharePoint Online sites (or site collections) to users only connecting when on the corporate network?

    Hi,
    We have an Office 365 environment which is linked to our on premise ADFS environment. We have started to make some deployments of sites to our SharePoint Online environment. For the majority of sites this is great and the ability to access the sites
    from anywhere is a real bonus. However, there are some sites and data that I would be much more comfortable in migrating to SharePoint Online if there were a way to make them only accessible via users/computers connected to the corporate network. 
    I have seen articles in how you can configure ADFS to allow all connections to the Office 365 tenant only from the network or not but what I am after is something which can be configured on a site by site basis (i.e. not the whole Office 365 environment
    or SharePoint Online environment) to only allow access when connecting from the corporate network.
    Any advice/help would be much appreciated?
    Many thanks
    Paul

    Hi,
    This is the forum to discuss questions and feedback for Microsoft Office, the issue is more related to SharePoint online, I recommend you post your question to the Microsoft Office 365 Community Sites and document sharing Forum
    http://community.office365.com/en-us/f/154.aspx
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    Thanks
    George Zhao
    Forum Support
    Come back and mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback on our support, please click "[email protected]"

  • Powershell Error for SharePoint Online -"The remote server returned an error: (407) Proxy Authentication Required."

    I am trying to call sharepoint online from powershell. Below is the code. I get 
    Exception calling "ExecuteQuery" with "0" argument(s): "The remote server returned an error: (407) Proxy Authentication Required."
    $loadInfo1 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
    $loadInfo2 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")
    $webUrl = "ZZZZ"
    $username = "XXX"
    $password = "YYYY"
    $ctx = New-Object Microsoft.SharePoint.Client.ClientContext($webUrl) 
    $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $password)
    $web = $ctx.Web
    $lists = $web.Lists 
    $ctx.Load($lists)
    $ctx.ExecuteQuery()
    $lists| select -Property Title
    Raj-Shpt

    Hi,
    About how to access SharePoint online site using PowerShell, the blog below would be helpful:
    http://social.technet.microsoft.com/wiki/contents/articles/29518.csom-sharepoint-powershell-reference-and-example-codes.aspx
    Another two demos for your reference:
    http://www.hartsteve.com/2013/06/sharepoint-online-powershell/
    http://www.sharepointnutsandbolts.com/2013/12/Using-CSOM-in-PowerShell-scripts-with-Office365.html
    Thanks
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

Maybe you are looking for

  • Mac being unable to sever connections and I can't access secure databases

    Recently my university library underwent a security rehaul, since then I have been unable to access secure databases to do research for papers and the like. After resetting my browser, emptying my cache, and shutting down my computer, I am unable to

  • Is it possible to make synchronous web service calls?

    Hi all, Is it possoble to get a web service call to block and wait for a response rather than doing it asynchronously using flex/action script? thanks

  • Syncing IBooks to IPad 1

    My original IPad 1 is broken.  I got another Ipad 1 and synced it up but all of my IBooks that I purchased from the ITunes store won't sync to the new IPad 1.  How can I get the new updated IPad ap for an old Ipad 1.  As of now, it won't work with th

  • Imported files are really blurry and pixelated?

    Help! I'm freaking out a bit over here. I designed several pages from a book and a magazine in Photoshop (text, images, graphics and all) and am now trying to import them into an InDesign document to send to the printer. I import them the proper way,

  • Error Msg: "internet connect" "could not find a pppoe server"

    Hi, I'm a mac newbie and am having problems with my new MacBook that I just bought and setup yesterday. When the setup asst is asking questions when I first started the computer, I mistakenly chose connect via pppoe. Then, when the setup asst ended,