How to get last modified date of a file in SharePoint Online document library using PnP PowerShell

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello and welcome everyone to my channel Koo Maven in today's episode we will see how to get last modified date of a file from SharePoint online site using PNP Powers so let's get started I have opened my browser and this is my site Ral this is a SharePoint online site this is the site URL I will go to the documents library and this is the file for which we will get the modified date using PNP power so let me tell you one thing I fall under IST time zone that is Indian Standard Time from where you can recognize this you go to site contents go to site settings from there then original settings and here you can see UTC + 5 30 hours uh time zone I in and you can set your time zone according to that based on this you can see the modified date and time like this according to your time zone here also this for this modified column I would suggest for this video particularly go to library settings more Library settings and then go to modified so I would say convert the display format from friendly to standard in standard format you will see date as well as the time like this okay so now we know our site collection URL and the document or the file for which we will uh be getting the modified date using PNP Powell so let's open the windows Powell I from here so if you have the SharePoint online Powershell module installed then you can start from here right away otherwise you need to install that module to install that module simply you have to run this command and it will install the SharePoint PNP Parell online module in your computer please note you have to run it using your administrative account so it is already installed in my PC so I'm not installing it right now this will be my first line of code connect PNP online and this is the SharePoint site URL we have if I go here you can see I have taken it from here until this https kf. sharepoint.net Factor authentication enabled it will ask for the MFA using while logging in then we need to write this line what this line means I have created one variable file undor relative URL so as the variable name suggests you have to give the relative URL of your file so you can go here and from sites you need to copy till here and then write the name of your file so this should be your relative URL next up we have this line of code this is basically getting the file using the variable we just created it and storing that into another variable named file okay so let's run this commands one by one first so you see we have now connected to the SharePoint online site next we run this one so you see this line of code has been successfully executed then I'm running this command as well this is giving me an error say file not found so I think we have to delete this person 20 from here person 20 is a encoded version of space so let's see if it is let's execute this line again yes now this this has been successfully executed Ed so if you have person 20 or some encoder for colon or underscore in your relative URL make sure you replace those before running those commands Okay so now we have our actual file with us so once we have the file the last command we need to run is to get the modified date from it this is the line dollar file Dot time last modified as the name is suggesting this will give you last modified date of a file and WR host is I'm just writing uh this output in our console here so let me clear this one and let me run this one yes so you can say you can see for download. JPG file which I am having here it is getting the date correctly and the time so the date is 20th January 2024 so it is bringing the date 20th January 2024 and the time here as per my regional setting is in istd 1:31 p.m. but here you can see it is 80142 because this time is always in UTC so let me show you this time is in UTC 8 and 01 so let me Google it convert col 01 a.m UTC time to is so you can see 131 801 m is 131 p.m. so here it is coming as 801 am UTC and because of my regional settings it is 1:31 p.m. in IST in the end you can simply write this command disconnect PNP online this is very important to disconnect all your open connections in the end just run this command and you are good to go so you can save this file save as say get last modified date of a file like this I'm saving it in desktop so in future go to Windows partial IC file open so I can open this one and I can run the whole file at a time so it is connecting and see it is giving me the date over here so I think everything is clear in this video if you have something uh some query in your mind just let me know in the comment section below and uh yeah if you liked uh my video then please like uh comment and share and subscribe to my channel as well thank you so much
Info
Channel: Codigo Maven
Views: 750
Rating: undefined out of 5
Keywords: sharepoint online, sharepoint list, sharepoint 365, sharepoint tutorial, sharepoint basics, sharepoint basics for beginners, sharepoint blogs, sharepoint basics beginner tutorial, sharepoint beginner tutorial, sharepoint communication site, sharepoint developer, sharepoint developer skills, sharepoint how to use, sharepoint get last item modified date, powershell, powershell scripting tutorial, powershell tutorial, learn powershell, pnp powershell, powershell scripting, Pnp
Id: E_y3Tf1pMJk
Channel Id: undefined
Length: 9min 14sec (554 seconds)
Published: Sat Jan 20 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.