sharepoint online – Programmatically remove external user access to a folder / document in a document library

Here is the script. Not tested You can also add subpages in another foreach.

string WebUrl = "https://company.sharepoint.com/sites/web";
string UserLoginName = "i: 0 # .f | membership | name.lastname_domain.com#EXT#@microsoft.com";

public static void RemoveUserPermissions (String SiteUrl, String UserLoginName)
{
using (var ctx = new ClientContext (SiteUrl))
{
var Web = ctx.Web;
var Lists = Web.Lists;
ctx.Load (ctx.Web);
ctx.Load (lists);
ctx.ExecuteQuery ();

Console.WriteLine (string.Format ("Remove user {0} from site: {1}", UserLoginName, SiteUrl));
var User = Web.SiteUsers.GetByLoginName (UserLoginName);
Web.RoleAssignments.GetByPrincipal (User) .DeleteObject ();
ctx.ExecuteQuery ();

foreach (var list in lists)
{
var UniqueListPerm = List.HasUniqueRoleAssignments;
ctx.Load (UniqueListPerm);
ctx.ExecuteQuery ();
if (UniqueListPerm)
{
Console.WriteLine (string.Format ("Remove a user from the list or library: {0}", UserLoginName, List.Title));
List.RoleAssignments.GetByPrincipal (User) .DeleteObject ();
ctx.ExecuteQuery ();
}

CamlQuery camlQuery = new CamlQuery ();
camlQuery.ViewXml = "";

var Items = list.GetItems (camlQuery);
ctx.Load (elements);
ctx.ExecuteQuery ();
foreach (var article in articles)
{
var UniqueItemPerm = Item.HasUniqueRoleAssignments;
ctx.Load (UniqueItemPerm);
ctx.ExecuteQuery ();

if (UniqueItemPerm)
{
Console.WriteLine (string.Format ("Removing a user from library {0} and item: {1}", List.Title, Item.Id));
Item.RoleAssignments.GetByPrincipal (User) .DeleteObject ();
ctx.ExecuteQuery ();
}
}
}
}
}

Is it possible to manage a SharePoint Online site through PnP templates in Source Control with automated deployments?

This is a pretty common workflow that I've used in several projects. The templates can be safely redeployed to the same website. However, look for templates that upgrade existing websites. The templates will not remove anything. Therefore, you may need to supplement the upgrade process with some PNP PowerShell if you make changes (rather than adding stuff, as the template will do).

I had a project that used the templates in one version, but that was a bit restrictive. Instead, I had to move the templates for another project to the blob store, and an Azure Automatio runbook, which was essentially a powershell script that downloaded the template and applied it with Apply-PnPProvisioningTemplate.

That way, we could add parameters to the script that were set at runtime through the runbook.

The beauty of this approach is that we can attach the runbook via flow to a SharePoint list that manages the websites to which the template will be applied.

SP 2013 Migration to O365 (Online Sharepoint)

Team,

In SP 2013, we created an application using the workflow of Infopath & SharePoint Designer 2013. We need to migrate them to O365 using metalogix.

Approach:
I suggested starting the migration instead of transforming Infopath into PowerApps and Workflow in Designer. After migrating the applications, it stays the same in O365. I chose it because we need to restore the content with metadata.

Can you tell me your thoughts or a better solution / approach that we can suggest here?

-Dhana

Rest Search API – SharePoint Stack Exchange

I try to retrieve images from multiple image libraries distributed across sub-sites using the REST SEARCH API (sub-sites are all under a single site collection https: // xyz / site / *). I also need to include different filters, z as & # 39; created by & # 39; along with a specific call to the sub-site libraries. I'm currently retrieving images from the entire site collection and can not limit the call to just subordinate sites.

sharepoint server – PowerShell: Generate a report of all elements of a site collection for which a column has a specific value

I am trying to script the following tasks in my SharePoint 2013 environment and have not had much luck.

I need a script that generates a report / CSV that lists all items in lists in which a site column has a specific value.

Suppose I have a site collection at http: // test / site and a site column called State. This column is used in several lists in my site collection. I need to create a report that shows all instances of items that have status column = texas.

Many thanks for your help.

sharepoint online – Search the content search web part search template to aggregate tasks

In a site collection, I have about 4 to-do lists, each set up on separate subsites. At the root level, I use a Content Search Web Part, and queries show tasks from these 4 to-do lists to show aggregated tasks in the Web Part. Here's the query I'm using: Path: "https: //.sharepoint.com / sites /"ContentTypeId: 0x0108 * -RefinableString01: Completed

RefineableString01 is an associated managed property that helps me display unfinished tasks (task status except completed). The challenge now is to show this web part as close as possible to an actual to-do list view that has the name, due date, status, and description as task headers / columns in CSWP, which I have not worked on at all.

Can someone help me set up the task aggregation tabular view using a custom template? For your information, I have already set up managed properties (mapping appropriate crawled properties to the managed properties called refining string, etc.) for description, task status, and due date.

Also, in CSWP, I'd like to display a custom selection column called Investor (site column) along with other base columns. I'm waiting for her to be crawled. Once crawled, I'll set up a managed property for it.

Can someone please help me with the cswp display template that i can use, thanks in advance.

SharePoint Online. Change the file contents with the Remote Event Receiver

I have to check the content of an Excel file uploaded to SharePoint. If the columns do not follow any order, switch them to get the required order.

I thought about a remote event receiver and hosted it in Azure.

I do not know if it's possible to retrieve the SPFile with the remote event receiver and download it to a local computer, modify the file as needed, and upload it back to SharePoint.

Is that a good approach? Can I do it without downloading it?

I searched but did not see how I could change the contents of a file hosted in a Sharepoint library.