Some thoughts on programming stuff

Tag: SharePoint (Page 1 of 4)

Auto archive items in SharePoint using Power Automate

SharePoint lists may grow bigger with time, that’s no doubt. Depending on your user base, you might start to feel performance issues after a few thousands of items created. That’s why it should be good for you to looking after auto archive items in SharePoint using Power Automate.

Why Power Automate? It is a great tool with seamless integration with SharePoint which allows you to reduce the toil and generate value by automating tasks. If you haven’t checked Power Automate before, it is a good opportunity to start looking into the Low Code world.

Continue reading

Auto archive files in SharePoint with Power Automate

A pretty common use case scenario where you might want to auto archive files in SharePoint with Power Automate. Sometimes it is important to move some files from one place to other, reducing the size of a library and the number of rows returned in a search. You can always explore the retention policies available out-of-box in SharePoint, of course. But sometimes this feature can present some problems depending on the content type or data type you are working with.

So if you have the option to work with Power Automate, why not using it? Power Automate is great when you need to automate one specific task and it is a very intuitive to use. It is fully integrated with SharePoint and you can take advantage of its connectors to do your tasks.

Continue reading

Export list in SharePoint via PowerShell

SharePoint lists are very powerful and we often need to export list data for our customers. One of the best option to achieve that is by PowerShell. So in this blog post we will cover how to export list in SharePoint via PowerShell. After exported to CSV, it’s easy to convert to an Excel format and do whatever you want. It’s important to say that this script will work on SharePoint Server On-Premises and you will need to enter the server to run it.

But why using a PowerShell if we can do that by the UI? Well, I need to agree with you. What I can answer about that? Basically, you can schedule exporting activities, you can take leave the script running on long lists without short timeouts, etc.

A SharePoint list - Export list in SharePoint via PowerShell
A SharePoint list (PowerApps blog)
Continue reading

Test SharePoint e-mail settings with PowerShell

In case you want to test SharePoint e-mail settings with PowerShell, you can achieve that by sending a dummy e-mail to yourself by running a simple PowerShell script. In this way you can ensure your SMTP settings are good and all SharePoint notifications or coding solutions that send e-mails will work.

It’s important to test it during the configuration of a new Farm. The steps for configuring it can be found on Microsoft docs. Or maybe if you need to troubleshoot the e-mail features in your SharePoint solutions. SharePoint has many automated alerts that work with Workflows, Approval processes and Access control forms.

Electronic e-mail - Test SharePoint e-mail settings with PowerShell
E-mail is a common way to communicate and alert (Wikimedia Commons)

PowerShell script for testing SharePoint e-mail settings

The script is pretty straightforward and you will need to update just two lines. One with the right e-mail going to receive the message and the Site Collection URL that is going to trigger the message.

That’s it! I hope this script can help you when you want to test SharePoint e-mail settings with PowerShell. Also on creating new solutions for monitoring your e-mail settings on the SharePoint farms you happen to work with.

In addition to that, in case you are interested in, you can check other posts featuring PowerShell scripts.

References:
SharePoint diary

Batch insert items in SharePoint with Power Automate

This blog post will cover how to batch insert items in SharePoint with Power Automate. Our Flow will explore the SharePoint REST API calling the Batch endpoint and inserting 1000 items per time. For every Batch request made, you can add multiple Changesets up to 1000 Changeset requests. Likewise, for each Changeset, you can only add up to 1000 requests. That’s why our example will try to insert 1000 items per request just to make things simple.

In the tests I have made, using this Flow we were able to insert 5000 items in 16 minutes. All of my tests were executed in a Free Microsoft Flow account. In the other hand you probably may experience a better performance if you have a licensed account. Consequently, using a licensed account, you will be able to read more than 5000 rows.

In addition to that, it’s important to say that our test is going to read data from an Excel file. Everything will be static like the filename and the table name from the file. But this doesn’t mean that you cannot do the same by passing dynamic values. If you create a flow that runs tied to a file creation event in SharePoint, you will get the data needed to make it dynamic and save your time with this automation.

7 use cases on automating data entry using RPA and document ...
Machine working in favor of humans (Klippa)

First steps on the Flow

In this example I chose to manually trigger a flow, just for it being easy to test. Needless to say tat you can change that for whatever you want.

Manually trigger a flow - Batch insert items in SharePoint with Power Automate
Manually trigger a flow
Continue reading

Batch delete items in SharePoint with Power Automate

This blog post will cover how to batch delete items in SharePoint with Power Automate. Our Flow will explore the SharePoint REST API calling the Batch endpoint and deleting 1000 items per time. For every Batch request made, you can add multiple Changesets up to 1000 Changeset requests. Moreover, for each Changeset, you can only add up to 1000 requests. That’s why our example will try to delete 1000 items per batch request just to make things simple.

In the tests I made, using this example we are able to delete 500 items in 2 minutes, 5.000 items in 12 minutes and 15.000 items in 40 minutes. All of my tests were ran in a Free Microsoft Flow account, so you probably may experience a better performance if you have a licensed account.

How do I recover and restore deleted files? | BT
Delete key (BT)

First steps on the Flow

In this example I chose to manually trigger a flow, just for it being easy to test. Needless to say tat you can change that for whatever you want.

Manually trigger a flow - Batch delete items in SharePoint with Power Automate
Manually trigger a flow
Continue reading

Restart Timer and Admin in SharePoint

SharePoint relies on Timer Service and Admin Service to run and manage its tasks. As any Windows Service, sometimes we need to stop and start them. That’s why I wrote this post to share a script on how to restart Timer and Admin in SharePoint.

These services are present in a SharePoint Server, inside the Windows Services list. There you can see both SharePoint Administration and SharePoint Timer Service:

  • The Admin Service performs administrative tasks for Windows Services under the Local Admin Network rights;
  • The Timer Service sends notifications and performs scheduled tasks for SharePoint services. It must run with an Account with Admin rights to server.
Timer and Admin Services - Restart Timer and Admin in SharePoint
Timer and Admin Services

Script to restart the timer and admin services

The script will load the SharePoint PowerShell dependencies and start by restarting the services in each machine present in the farm. This can throw an error if the Windows Servers are not properly configured to allow remote changes to their services.

Finally, in the end we use some objects provided by the SharePoint DLL to ensure that every Timer service is online and available.

There are other services required to run SharePoint, but it depends on how you are exploring its features. Here is the list of possible mandatory services that you may face and even restart if you want (haha):

  • SharePoint Tracing;
  • SharePoint User Code Host;
  • SharePoint VSS Writer;
  • World Wide Web Publishing Service;
  • SharePoint Server Search.

That’s it! I hope this post can be helpful when you want to restart Timer and Admin in SharePoint. Also you may find useful other posts related to PowerShell in the blog posts available.

References:
StackOverflow

Export user permissions in SharePoint

This post will present a Powershell script that will let you Export user permissions in SharePoint from all Web Applications and their Site Collections.

The script creates a CSV file and fills the data in the columns like below:

  • Site Name;
  • Site Url;
  • Name of the Group;
  • Login of the Group Owner;
  • Display name of the Group Owner;
  • User Login (who has the permission);
  • User Display Name (who has the permission);
  • The role or permission the user has.
Report after being exported (in Brazilian Portuguese) - Export user permissions in SharePoint
Report after being exported (in Brazilian Portuguese)
Continue reading

SharePoint breadcrumb for better navigation

This blog post will talk about an idea of customization of the SharePoint breadcrumb for better navigation. The solution uses the out-of-box Delta Breadcrumb Dropdown component to provide the data required to render the breadcrumb using pure JavaScript for that.

Important notes:

  • This solutions works only for Classic Experiences;
  • I would recommend enabling only to internal pages branded using the System Master Page;
  • The JavaScript needs to be installed using a Custom Action or calling the JS file from the Master Page;
  • This solution may not be a good practice for SharePoint Online environments, if you are focused on working only with Modern experiences.
Continue reading

Change List Template language to reuse it in another Site with different language

When importing a list template from another Site or Site Collection built in a different language, you may not be able to see it as an App available to add to your site. It happens because SharePoint will look for the List Templates available in the current language for the Web Site. I’ve experienced it recently when migrating a list from a site collection in Portuguese to another site collection in Spanish, that’s why I decided to write this blog post that teaches how to change List Template language to reuse it in another Site with different language

In this post we will give you a PowerShell that may help you on migrating the list easily.

Continue reading
« Older posts

© 2024 wiliammbr's blog

Theme by Anders NorenUp ↑