Monday 24 September 2018

BOOK OF NEWS - Microsoft Ignite 2018 September 24–28 // Orlando, FL

Tech Folks,

Check Out!

Here is the link to the Microsoft's'  BOOK OF NEWS @ Microsoft Ignite 2018 September 24–28 // Orlando, FL.

Sunday 23 September 2018

PowerShell Script To Get Web Application Admin Data - SharePoint

At some point, SharePoint Admins may need to obtain a web application's information, like total sites underneath, size of each site, total list count, site admin's login name, site owners, site URL etc. 
The below PowerShell script does the job at one shot and exports the data into .CSV.
You can customize the script based on your requirement. 
  1. If((Get - PSSnapIn - Name Microsoft.SharePoint.PowerShell - ErrorAction SilentlyContinue) - eq $null) {  
  2.     Add - PSSnapIn - Name Microsoft.SharePoint.PowerShell  
  3. }  
  4. #using the reflection assembly  
  5. [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")  
  6. # Give the Web Application Name  
  7. $webApp = 'http://webappname'  
  8. #Give the File name of the CSC  
  9. $filename = "FileName.csv";  
  10. $ListItemCollection = @()  
  11. $SPWebApp = Get - SPWebApplication $webApp  
  12. # iterating all the sites in the Web Application  
  13. foreach($SPSite in $SPWebApp.Sites) {  
  14.         if ($SPSite - ne $null) {  
  15.             foreach($SPWeb in $SPSite.AllWebs) {  
  16.                 $WebSize = GetFolderSize($SPWeb.RootFolder)  
  17.                 # Calling the function to calculate Folder Size  
  18.                 # Get Recycle Bin Size  
  19.                 foreach($RecycleBinItem in $SPWeb.RecycleBin) {  
  20.                     $WebSize += $RecycleBinItem.Size  
  21.                 }  
  22.                 #To get the Sub Site Size in MB  
  23.                 $subSiteSize = [Math]::Round($websize / 1 MB, 2)  
  24.                 # To get site owners in the associated owners group  
  25.                 $siteOwners = ""  
  26.                 $siteOwnersGID = ""  
  27.                 foreach($ownerGroup in $SPWeb.AssociatedOwnerGroup) {  
  28.                     foreach($owner in $ownerGroup.Users) {  
  29.                         $siteOwners = $($owner.DisplayName) + "|" + $siteOwners  
  30.                         $siteOwnersGID = $($owner.UserLogin.Split('\')[1]) + "|" + $siteOwnersGID  
  31.                             }  
  32.                         }  
  33.                                                                    
  34.                         #To Get Site Admins  
  35.                         $siteAdmins = ""  
  36.                         foreach($siteAdmin in $SPWeb.SiteAdministrators) {  
  37.                             $siteAdmins = $siteAdmin.LoginName + "|" + $siteAdmins  
  38.                         }#Object for gathering all the required columns  
  39.                         $ExportItem = New - Object PSObject  
  40.                         write - host "DATA"  
  41.                         $SPWeb.Title $siteOwners $siteOwnersGID $siteAdmins $SPWeb.Url $SPWeb.Lists.Count $SPWeb.LastItemModifiedDate $([Math]::Round($SPSite.Usage.Storage / 1 MB, 2)) $subSiteSize  
  42.                         $ExportItem | Add - Member - MemberType NoteProperty - name "Title" - value $SPWeb.Title  
  43.                         $ExportItem | Add - Member - MemberType NoteProperty - name "Site Owner(s)" - value $siteOwners  
  44.                         $ExportItem | Add - Member - MemberType NoteProperty - name "Site Owner(s) GID" - value $siteOwnersGID  
  45.                         $ExportItem | Add - Member - MemberType NoteProperty - name "Site Admin(s)" - value $siteAdmins  
  46.                         $ExportItem | Add - Member - MemberType NoteProperty - name "Site Url" - value $SPWeb.Url  
  47.                         $ExportItem | Add - Member - MemberType NoteProperty - name "List Count" - value $SPWeb.Lists.Count  
  48.                         $ExportItem | Add - Member - MemberType NoteProperty - name "Last Modified Date" - value $SPWeb.LastItemModifiedDate  
  49.                         $ExportItem | Add - Member - MemberType NoteProperty - name "Site Collection Size (MB)" - value $([Math]::Round($SPSite.Usage.Storage / 1 MB, 2))  
  50.                         $ExportItem | Add - Member - MemberType NoteProperty - name "Sub Site Size (MB)" - value $subSiteSize  
  51.                         # Exporting to.CSV File  
  52.                         $ListItemCollection += $ExportItem  
  53.                         $destination = "D:\" + $filename  
  54.                         $ListItemCollection | Export - CSV $destination– NoTypeInformation  
  55.                     }  
  56.                 }  
  57.             }  
  58.             #Function to calculate folder size  
  59.   
  60.             function GetFolderSize($folder) {  
  61.                 $FolderSize = 0  
  62.                 foreach($File in $Folder.Files) {  
  63.                   #Get File Size  
  64.                     $FolderSize += $file.TotalLength;  
  65.                   #Get the Versions Size  
  66.                     foreach($fileVersion in $file.Versions) {  
  67.                         $FolderSize += $fileVersion.Size  
  68.                     }  
  69.                 }  
  70.                 foreach($subfolder in $folder.SubFolders) {  
  71.                     $FolderSize += GetFolderSize $SubFolder  
  72.                 }  
  73.                 return $FolderSize  
  74.             }  
 OutPut ScreenShot
OutPut

SharePoint 2019 - Things To Know

Microsoft has announced the next on premises version of SharePoint Server will be called SharePoint 2019 and the preview will be available mid-year in 2018.

SharePoint  

Next-Gen Sync Client Support
The Sync Client allows users to synchronize content from SharePoint with their local computers, similar to the tool used for OneDrive for Business; the Sync Client had a checkerd early history but has steadily improved in the Office 365 space. Expect a fast and reliable synchronization experience. It should be noted that Microsoft does not intend to bring support for the Sync Client to SharePoint Server 2016.

Modern UX throughout the product 
Modern lists, libraries and pages (let’s hope it means Communication sites, hub sites etc..)

SharePoint  
 
Flow / Power Apps integration 

List integration with Flow and PowerApps (more than what we have today). I expect this also means our ability to more easily generate flows to move data from on prem to cloud and vise versa. Microsoft has now confirmed PowerApps and Microsoft Flow as its successor products to InfoPath and SharePoint Designer, used for forms and workflow development respectively, by developers and power users. Interestingly for InfoPath, the form-building tool that's enjoyed a love-hate relationship with SharePoint developers for over a decade, talk of its imminent demise seems premature. Microsoft has flagged its continuation to at least 2026, in line with the expected lifespan of SharePoint Server 2016. 

In summary, SharePoint Server 2019 is shaping up as a significant product release. It will continue to support Microsoft customers who wish to maintain the capability for on-premises content storage, while leveraging Microsoft's investments in Office 365 and SharePoint Online, to bring state-of-the-art functionality to SharePoint Server.

How To Join The Office 365 Developer Program

Hello folks, I am writing this article with my personal experience in creating a free developer subscription for Office 365 for one year.
Here are the steps to be followed.
  1. Create a Microsoft Account (Outlook, live, Skype etc...) if you don’t have one. I have created a Microsoft account using Outlook.
  2. Login to this site using the Outlook account credentials.

    Office 365
  1. Click on Join Now and fill out the required fields. Then, click "NEXT".

    Office 365
  1. Select the areas of your interest and click "JOIN".

    Office 365

    Office 365
  1. After a few minutes, you’ll get the below welcome screen which asks you to set up a new Office 365 developer subscription.

    Office 365
  1. Click "SET UP SUBSCRIPTION" to proceed.

    Office 365
  1. Fill up the required fields and click on "Set up".

    Office 365

    Office 365
  1. On successful process completion, you’ll be seeing your subscription information, click on "office.com" and sign in using your newly created subscription name and password.

    Office 365
  1. Once you sign in for the first time, you’ll be landing in the Office365 Homepage, click on the "Admin Link" to get started.

    Office 365
  1. You’ll get the welcome screen which will take you on a small tour about the navigation.

    Office 365
  1. Once you get familiar with the navigational elements, here comes the most important step for Office 365 Enterprise E3 Developer setup. On the Admin Center home page, you’ll be able to find the setup screen to proceed forward. Click on "Go to setup" to proceed. If you are not able to find the below screen. Search in the search bar on top of the page.

    Office 365
  1. Once you click on Go to Setup, you’ll be landing in a page to choose the domain where you get the option to choose the domain of your choice which you already own else you continue using the one which you just created here for the O365 subscription. I choose option 2 and click "Next".

    Office 365
  1. Here comes the license part. You have 25 of 25 license(s) available for this subscription to make use of. It’s up to you how you make use of it. I leave it blank and clicking "NEXT".

    Office 365
  1. Now assign the license for the user which I am going to use for the development activity which means you have 24 of 25 license(s) available. Click on next.

    Office 365
  1. We will get the option of sharing the credentials of the user by giving their alternate Email ID.

    Office 365

    Office 365
  1. Click on "Next". You get the option to install the Office apps to your PC’s up to 5 devices. It’s up to you if you install it or not. Click on "Next" to proceed.

    Office 365

    Office 365
  1. That’s all. We are done with setting up the subscription. Set your password to never expire as an important recommendation. Click on "View Recommendation" and save and close.

    Office 365

    Office 365


    Office 365
  1. Finally, we can make use of the subscription to get started with the development activity for Office and SharePoint Online solutions like Powerapps, OneDrive etc...

    Office 365
  1. Play around with the "Admin Site" to get familiar with the navigation and get things done.
  1. Say, for example, you wanted to go creating a Communication site in SharePoint online, click on SharePoint from the O365 root menu.

    Office 365

    You’ll get landed in the SharePoint Online home page for creating sites to work with.

    Office 365
  1. Click on Create site > Communication site.

    Office 365
  1. Give a name for the site and click "Finish".

    Office 365
  1. Your first communication site gets created in a matter of seconds. 

    Office 365
Sharing is caring!!
Happy SharePointing!!

Get All Checked Out Items From A Site Collection Using PowerShell In SharePoint 2013

At some point, your architect/manager/customer may ask you to perform a SharePoint Migration from one version to another version. At that time, you'll be asked to analyze a lot of factors, like total data to be migrated, workflows, solution files etc. Along with that, one of the most important things is files uploaded in the document library.
SharePoint
Let’s say, for example, you use the Metalogix Context Matrix tool. In that, the checked out files in document library won't be migrated. To identify the files which are checked out in the entire site collection is a very tedious task manually. The below piece of PowerShell code makes life easier by getting the checked out files in the site collection in one shot. Here is the PowerShell code which will get the document library items from the site collection which are checked out. 
  1. #Add the PowerShell SnapIn Add - PSSnapin microsoft.sharepoint.powershell  
  2. # Enter the Site Collection URL $spWeb = Get - SPWeb "http://insiscvmsrv70:8888/sites/KM/"  
  3. #Function to get the CheckedOut items in document library  
  4.   
  5. function GetCheckedItems($spWeb) {  
  6.     Write - Host "Scanning Site: $($spWeb.Url)"  
  7.     foreach($list in ($spWeb.Lists | ? {  
  8.         $_ - is[Microsoft.SharePoint.SPDocumentLibrary]  
  9.     })) {  
  10.         Write - Host "Scanning List: $($list.RootFolder.ServerRelativeUrl)"  
  11.         foreach($item in $list.CheckedOutFiles) {  
  12.             if (!$item.Url.EndsWith(".aspx")) {  
  13.                 continue  
  14.             }  
  15.             $writeTable = @ {  
  16.                 "URL" = $spWeb.Site.MakeFullUrl("$($spWeb.ServerRelativeUrl.TrimEnd('/'))/$($item.Url)");  
  17.                 "Checked Out By" = $item.CheckedOutBy;  
  18.                 "Author" = $item.File.CheckedOutByUser.Name;  
  19.                 "Checked Out Since" = $item.CheckedOutDate.ToString();  
  20.                 "File Size (KB)" = $item.File.Length / 1000;  
  21.                 "Email" = $item.File.CheckedOutByUser.Email;  
  22.             }  
  23.             New - Object PSObject - Property $writeTable  
  24.         }  
  25.         foreach($item in $list.Items) {  
  26.             if ($item.File.CheckOutStatus - ne "None") {  
  27.                 if (($list.CheckedOutFiles | where {  
  28.                         $_.ListItemId - eq $item.ID  
  29.                     }) - ne $null) {  
  30.                     continue  
  31.                 }  
  32.                 $writeTable = @ {  
  33.                     "URL" = $spWeb.Site.MakeFullUrl("$($spWeb.ServerRelativeUrl.TrimEnd('/'))/$($item.Url)");  
  34.                     "Checked Out By" = $item.File.CheckedOutByUser.LoginName;  
  35.                     "Author" = $item.File.CheckedOutByUser.Name;  
  36.                     "Checked Out Since" = $item.File.CheckedOutDate.ToString();  
  37.                     "File Size (KB)" = $item.File.Length / 1000;  
  38.                     "Email" = $item.File.CheckedOutByUser.Email;  
  39.                 }  
  40.                 New - Object PSObject - Property $writeTable  
  41.             }  
  42.         }  
  43.     }  
  44.     foreach($subWeb in $spWeb.Webs) {  
  45.         GetCheckedItems($subWeb)  
  46.     }  
  47.     $spWeb.Dispose()  
  48. }  
  49. GetCheckedItems($spWeb) | Out - GridView  
  50. # As an alternate option you can export the data to a textfile as well.Uncomment below code to do that  
  51. # GetCheckedItems($spWeb) | Out - File c: \CheckedOutItemsInSiteCollection.txt - width 300  
Once you run the PowerShell script using PowerShell ISE, you get the below output.
Output

Hope it helps fellow developers.

Featured post

Getting Started with Hub Sites in SharePoint Online

Hello Folks, Today, I have just Completed my First C# Corner Webinar on the topic Getting Started with Hub Sites in SharePoint Online . W...

Popular Posts