How To Check Whether The List/Library Item Is A File Or A List Folder In SharePoint Online Using Online PowerShell script

Below code help to identify the SharePoint Online list/library (all) items folder and file. Based on that you can delete the file or folder. If you want generate the inventory of the list/ library you can use this code. (Change the list template Id or name)

if you have any Query please let me know.

Prerequisites 

  • Download SharePoint online Management Shell and Install
  • Enable the execution policy true (Check DOS command..
  • Copy the below code and create XX.ps1 file and execute it Online Management Shell.
  • You Should have Tenant admin permission


Powershell code to generate folder and file item in a SharePoint online list/library 

#Copy start here
--------------------------------------------------------------
function Get-SPOWeb()

{

param (

        $SPOCredentials,

$Url,        

$IncludeSubsites=$false

)

write-host "Inside spoweb" -foregroundcolor green



  $ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url)

  $ctx.Credentials =  $SPOCredentials

  $ctx.Load($ctx.Web)

  $ctx.Load($ctx.Web.lists)

  $ctx.Load($ctx.Web.Webs)

  $ctx.ExecuteQuery()

  
  write-host "Inside spoweb  - Before for each loop " -foregroundcolor green
  Write-Host "(Lists count: "$ctx.Web.lists.count")"
  
foreach($list in $ctx.Web.lists) 

    {

try{

   #.. write out every document library which is not the standard "Site Assets"
       
       # if(($list.BaseTemplate -eq 101) -and ($list.Title -ne "Site Assets") -and ($list.Title -eq "TestLibrary100"))
       #if document library use the below if 
       # if(($list.BaseTemplate -eq 101)

       #If coustom library use the below if Replace the  TestLibrary name with your custom library
        
        if($list.Title -eq "TestLibrary")

        {

            Write-Host "Web:" $ctx.Web.Url -foregroundcolor green

Write-Host "ListTitle:" $list.Title -foregroundcolor green

#Write-Host "BaseTemplate:" $list.BaseTemplate -foregroundcolor green

$camlQuery = New-Object Microsoft.SharePoint.Client.CamlQuery


#Retrive all list item with filter <Gt> replace based on your requirements

$camlQuery.ViewXml ="<View Scope='RecursiveAll'><Query><OrderBy><FieldRef Name='Modified'/></OrderBy><Where><Gt><FieldRef Name='Modified' /><Value IncludeTimeValue='TRUE' Type='DateTime'>2013-01-01T11:34:54Z</Value></Gt></Where></Query></View>"

$allItems=$list.GetItems($camlQuery)

$ctx.Load($allItems)

$ctx.ExecuteQuery()
                 
            Write-Host "ExecuteQuery passs" 
                              

$Itemscount=$allItems.count
            


Write-Host "List items count:" $Itemscount
            
  
                 

$fileref=''

$itemexit=$false

$itemcounter=0

if ($Itemscount-gt0)  

{  

for ($i=$Itemscount-1; $i-ge0; $i--)  

{  

$item=$allItems[$i];

$fileref=$item["FileRef"]



$siteInfos = $itemStructure | Select-Object *; 

Write-Host "Fileref" $fileref

Write-Host "SiteURL" $ctx.Web.Url

Write-Host "Modified" $item["Modified"]

                    Write-Host "FSObjType" $item["FSObjType"]

$siteInfos.File=$fileref

$siteInfos.SiteURL=$ctx.Web.Url

$siteInfos.Modified=$item["Modified"]

                    $siteInfos.Modified=$item["FSObjType"]
                    

$global:sitesList += $siteInfos
                   
                  # FSObject type data 0 means item is file and  1 means folder. based on that you can generate the result and delete files or folder
                  # t       
                  
                   if ($item["FSObjType"] ==0)
                     {

  $allItems[$i].DeleteObject()  

$itemexit=$true

$itemcounter=$itemcounter+1
                    }  

}   

#Execute only when items found

if($itemexit)

{



$ctx.ExecuteQuery()

Write-Host "Files Deleted succesfully"

}

}



       

}

       }

   catch{

Write-Host "Error while reading list:" $list.Title "$($_.Exception.Message)" -foregroundcolor red

}

    }



if($ctx.Web.Webs.Count -gt 0 -and $IncludeSubsites)

{

Write-Host "--" -ForegroundColor DarkGreen

for($i=0;$i -lt $ctx.Web.Webs.Count ;$i++)

{

write-host $ctx.Web.Webs[$i].Url



   Get-SPOWeb -SPOCredentials  $SPOCredentials -Url $ctx.Web.Webs[$i].Url -IncludeSubsites $IncludeSubsites

  }

}

   

 }    


Import-Module Microsoft.Online.SharePoint.PowerShell


#Replce with your sharepoint Online admin URL  not a site URL
# You need to have admin access in the tenant else it wont work

$adminUrl = "https://#######.sharepoint.com"
#Replace your user name  
$userName = "############"
$password = Read-Host "Please enter the password for $($userName)" -AsSecureString
$credentials = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $userName, $password
$SPOCredentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($userName, $password)
Connect-SPOService -Url $adminUrl -Credential $credentials
write-host "Info: Connected succesfully to Office 365" -foregroundcolor green
# Local variables
$global:sitesList = @()
$delimiter=","

# Build structure what are the fields you want pls update List/library columns

$itemStructure = New-Object psobject 

$itemStructure | Add-Member -MemberType NoteProperty -Name "File" -value "" 

$itemStructure | Add-Member -MemberType NoteProperty -Name "Modified" -value ""

$itemStructure | Add-Member -MemberType NoteProperty -Name "FSObjType" -value ""

$itemStructure | Add-Member -MemberType NoteProperty -Name "SiteURL" -value ""

write-host "SPOWeb-Start"

# give your site collection url-- Get-SPOWeb -SPOCredentials $SPOCredentials -Url "https://##########/xyz" -IncludeSubsites $true

try{

#File creation

$guid=[guid]::NewGuid()

$listfilepath="H:\PowershellResults\Documentlist_"+$guid+".csv"

$sitesList | Where-Object {$_} | Export-Csv -Delimiter "$delimiter" -Path $listfilepath -notype

#####

write-host "Excel file created in this location:" $listfilepath -ForegroundColor Green

}

catch{

write-host "Excel file not created. Please check file path and try again." -ForegroundColor Red

}
# Copy End Here
-----------

Nintex SharePoint Online Approval Process not supporting Lazy approval process


Team,


SharePoint Online Migration Check List

Currently I am involving in a major SharePoint Migration project from SharePoint 2010 to SharePoint online.

Most of the existing Business process contains (workflow) approval process in different levels.   Such as approval from Manager,admin and finally service desk.  But in Nintex SharePoint online version won't support the Lazy approval fully.

Means You can't get the Approver name and Approver Comments. If you used a AD group in approval process, the task list will be updated with Group name and Modified Name  will be updated with "Sharepoint APP"  You can't get the Approver name and comments.

Nintex keep on telling some workaround, but in real time we are not able to achieve it

Before buying the Nintex tool please consider this factor for migration.

You can get the Approver name and comments using office 365 flow.

hope the above information useful to you. if you like please share your comments.

If you find any other alternative please share.

Thanks
Devarajan SM (Deva)
SharePoint Architect.


SharePoint new Release. SharePoint 2019 Hub Site Latest SharePoint news

Microsoft announced a mid-2018 release date for SharePoint 2019

You can find more details in the below mentioned links

https://techcommunity.microsoft.com/t5/SharePoint-Blog/SharePoint-hub-sites-new-in-Office-365/ba-p/109547


Sharepoint specific update you can find in the below links

https://collab365.community/sharepoint-2019-announced-complete-round-ignite/

http://www.cmswire.com/digital-workplace/mark-your-calendars-microsoft-announces-mid-2018-sharepoint-2019-release/




Few updates of sharepoint 2019:

SharePoint Hub Sites: New Intranet Building Tool
The Redmond, Wash.-based company also announced it will release SharePoint hub sites next year, with an expected roll out to Office 365 First Release customers in the first half of 2018.

SharePoint hub sites are a new intranet-building element that will bring together related sites under a unified look and feel with shared navigation. 

“The digital workplace is dynamic and ever changing. Business goals and team structures evolve and change — often frequently,” Mark Kashman, senior product manager on the SharePoint team wrote in a blog about the new release.

“SharePoint helps your organization adapt, by connecting your workplace with intelligent content management and intranets that give you the tools to share and work together, and to inform and engage people across the organization. And now it gets easier to organize your intranet dynamically.”

What stands out amongst the new functionality included in hub sites is the ability it gives intranet managers to combine multiple team sites and communication sites in one place to create an intranet that reflects the way enterprises work.

Even better, Microsoft designed the new hubs with mobile devices in mind. The SharePoint mobile app will be updated to natively render hub sites, and their pages, news and content, as well as providing smooth navigation between associated sites.


excel and other useful formula and links

1. Excel formula for date and otheres =CONCATENATE("insert into #brand_weeks select '",B4,"','",TEXT(C4,"mm/dd/yyyy"),"'")

good to refere to start the code.
2. http://www.codeproject.com/Articles/399156/SharePoint-Client-Object-Model-introduction


 

SP 2013 Learnings Important links



1. How to Configure Email Enabled Document Libraries in SharePoint 2013 
     Video -  https://www.youtube.com/watch?v=FpFSsQUzi7M

2.How to configure the site access requests in Sharepoint 2013
    Article -  http://blog.cloudshare.com/2012/12/09/how-to-configure-the-site-access-request-in-sharepoint-2013/

3.Good video for share point development 2010
http://www.youtube.com/watch?v=7c-6GrWuwbQ

4.2013 info path form.
https://www.youtube.com/watch?v=YykPToPH0Cc
5.http://www.youtube.com/watch?v=sFiPtoGpjFI
SharePoint 2010 | Cascading Lookup Field using Client Object Model

5.   client object model sample code : pagination, add, update,delete

http://msdn.microsoft.com/en-us/library/office/ee857094%28v=office.14%29.aspx


6.http://www.learningsharepoint.com/2010/07/27/programatically-create-user-groups-client-object-model-sharepoint-2010/

7.https://www.facebook.com/learning.sharepoint.page   - good tips


work at home:
8.http://www.oclktrk.com/f.php?btid=024-SPU-1049789-441-BTIDP95ennPPBzY_&u=http%3A%2F%2Fovaed.com%2Fclick%3Foffer%3D368%26aff%3D41%26subid%3DBamboosolutions.com%26subid2%3D024-SPU-1049789-441-BTIDP95ennPPBzY_&p=Greener Web


Please read the user feedback.

How to update table which is having trigger..

 alter table CampaignBuyer disable trigger
begin tran
update CampaignBuyer
set b.user_id = c.user_id
-- select b.user_id,c.user_id,b.*
from CampaignBuyer b,  #test c
where
b.market_code = c.market_code
and b.campaign_id = c.campaign_id
and b.notes = c.notes
and b.buy_due_date = c.buy_due_date
and b.assigned_date = c.assigned_date
and b.station_replicate_flag = c.station_replicate_flag
and b.buyer_type = c.buyer_type
commit tran
rollback tran
alter table CampaignBuyer enable trigger

----

SPFX - HTTPClient - Curd Operations - SharePoint list.

  Create solution in the name of SpfxCrud. ISpfxCrudProps.ts export interface ISpfxCrudProps {   description : string ;     context : an...