Delete this document library is missing in SharePoint Online


Please use the below CSOM to enable “Delete this document library”.

CSOM:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.SharePoint.Client;
using System.Security;

namespace DeleteList
{
class Program
{
static void Main(string[] args)
{
string password = “**********”;
SecureString pass = new SecureString();
foreach (char ch in password.ToCharArray())
pass.AppendChar(ch);
ClientContext cc= new ClientContext(“https://sharepointconnectblog.sharepoint.com/test “);
//Please change the login credentials with yours
cc.Credentials = new SharePointOnlineCredentials(“sathiya@sharepointconnectblog.onmicrosoft.com”, pass);
List olist = cc.Web.Lists.GetByTitle(“Demo”);
cc.Load(olist,list=>list.AllowDeletion);
cc.ExecuteQuery();
olist.AllowDeletion = true;
olist.Update();
cc.ExecuteQuery();
}
}
}

Advertisements

CSOM to find all the sub sites


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.SharePoint.Client;

namespace Retrieve_Sub_webs
{
class Program
{
static string mainPath = “https://sharepointconnectblog.wordpress.com/ “;
static int count = 0;
static void Main(string[] args)
{
ClientContext ctx = new ClientContext(“https://sharepointconnectblog.wordpress.com/sites/test “);
Web cweb = ctx.Web;
ctx.Load(cweb, subsite=>subsite.Webs);
ctx.ExecuteQuery();

foreach(Web oweb in cweb.Webs)
{
Console.WriteLine(mainPath+oweb.ServerRelativeUrl);
string fullurl = mainPath + oweb.ServerRelativeUrl;
count = count + 1;
getsubweb(fullurl);
}
void getsubweb(string context)
{
ClientContext cc = new ClientContext(context);
Web subweb = cc.Web;
cc.Load(subweb, subwebsites => subwebsites.Webs);
cc.ExecuteQuery();
foreach (Web ooweb in subweb.Webs)
{
Console.WriteLine(mainPath+ooweb.ServerRelativeUrl);
string fullurl = mainPath + ooweb.ServerRelativeUrl;
getsubweb(fullurl);
count = count + 1;
}
}
Console.WriteLine(count);
}
}
}

CSOM to find InfoPath Form Libraries


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.SharePoint.Client;

namespace Find_Infopath_libraries
{
class Program
{
static void Main(string[] args)
{
ClientContext cc = new ClientContext(“https://sharepointconnectblog.wordpress.com/sites/Test/ “);
Web oweb = cc.Web;
ListCollection lst = oweb.Lists;
cc.Load(lst);
cc.ExecuteQuery();
foreach(List olist in lst)
{
if(olist.BaseTemplate==115)
{
Console.WriteLine(olist.Title);
}
}
}
}
}

Unable to check in xsn file of the workflow


In previous post, we have seen one of the scenario where we do not receive any error in checking in the xsn file but still being checked out and how to solve it. In this post, we will see another case where we receive an error in checking in the xsn file.

SCENARIO:

Ownership has been taken for the xsn file as described in this post. Go to designer and click on All Files->Workflows. Click on the desired workflow to see the xsn file now. Please select the xsn file and click on “check in”. The below error occurs.Check In

SOLUTION:

  • In SharePoint Designer, click on All Files-> Workflows
  • Right click on workflows and select properties
  • It shows the Workflows List page. Click on Edit list Columns as shown below

Workflow List Columns

As you could see, Title column of Workflow list is shown as Required. Change it to Optional by clicking on Yes and checking “Allow blank Values” for Title column.

List Columns

Save the changes and check in the xsn file. That’s it:)

 

Unable to check in xsn file of the workflow


SCENARIO:

Xsn file is checked out to the user who has left the company. Ownership has been taken for the xsn file as discussed in previous post but could not be checked in. Only two options are available in Sharepoint designer.

  • undo check out – If we click on undo checkout, the below error is thrown

Discard CheckOut

  • Check in – If we check in, there is no error but still the file is checked out.

SOLUTION:

The solution is to check if Title is mandatory(required) in any of the workflow content type

  • The Workflow has two content types
    • Folder
    • User Workflow Document(Default)
  • Title column in user workflow document is shown as optional in designer but on checking in browser, it is shown as required
  • To see the columns of user Workflow document, please use the below link
  • Click on Title under columns and change the column settings from Required to optional and hit ok
  • Now, try to check in the xsn fle and yeah it is working now💃

Server error: The file is checked out for editing by the user


SCENARIO:

Workflow was migrated from SharePoint 2010 site to online. After few months, changes were requested for the workflow and the below error was encountered in publishing the changed workflow.

The error says that xsn file of the workflow is checked out to the user. On clicking ok, the second error was shown.

To override check out, we searched xsn file in designer but it was not found. Also, the user to whom the file is checked out has left the company.

SOLUTION:

  • Go to All Files and right click on Workflows and select properties
  • Copy the List Id of the workflows

  • Paste the list id  in the below url
  • Click on “Manage files which have no checked in version” under Permissions and Management
  • Select the workflow file and click “Take  Ownership of selection”
  • Now, the file will be shown in designer. Make changes and publish the workflow

The workflow was published successfully but the xsn file is still checked out to me and it may cause a problem when i am moved out of the company. Let’s see how to check in the xsn file in next post. 

This form cannot be opened in a web browser. To open this form, use Microsoft InfoPath


SCENARIO:

We have encountered the below error, “This form cannot be opened in a web browser..” upon clicking the link from email in outlook.

This email is triggered by SharePoint 2010 workflow from SharePoint online site with hyperlink text as “SharePoint Link” and value as current item: URL Path

SOLUTION:

  • Open the workflow that sends the email in SharePoint Designer
  • Select the hyperlink text(SharePoint Link) in send email action and click on hyperlink icon

  • In Edit hyperlink dialog box, click the string builder and change the lookup.
  • Change Data source from Current item to Workflow Context and Field from Source to Current Item URL.
  • Finally append “?NoRedirect=True” to get the below result

  • Publish the workflow and see the magic.

Associated list is empty in SharePoint designer workflow


SCENARIO:

An enhancement could not carried out for a migrated workflow whose associated list is blank in designer as shown below and could not be seen in the workflow section of the list in designer.

Upon editing the workflow, the fields used in workflow are shown as blank since the associated list is empty.

However, the workflow is working and is shown in workflow settings of a list in the browser.

SOLUTION:

  • Open the site in SharePoint Designer and click on All Files in Site Objects
  • Click on Workflows and select the workflow whose list association is empty in designer
  • There will be four files for the workflow with extensions .xoml, .xoml.Rules, .xoml.wfConfig.xml and .xsn
  • Click on .xoml.wfconfig.xml file and edit the file.
  • Verify the “Association ListID” in the file with our List ID
    • There are multiple ways to find the List ID. Let’s use the designer to find the List ID as it is already opened for the workflow
    • To find our List ID, click on Lists and Libraries in Site Objects and click the library
    • List ID is shown below the web address. Compare this ID with Association ListID

  • As it does not match, change the “Association ListID” in workflow configuration file and save.
  • Close the designer and reopen. Now, the associated list will be shown for the workflow.
  • Publish it to see this workflow in the workflow section of the list in SharePoint designer
  • Make enhancements and publish it again. That’s it 🙂

Exploring Microsoft Teams


Creating Teams creates Office 365 group, a SharePoint online team site and Exchange online group mailbox. Let’s concentrate on teams from SharePoint perspective.

Teams consists of Channels. Channels are nothing but folders in SharePoint Documents library. Each team can contain 200 channels. When a new team is created in Microsoft teams, (say SP operation support) default channel called “General” is created. In the back end, it creates a SharePoint site with team name and creates a folder called “General” in Shared documents(Documents) library. Adding a new channel called Test, will create folder named “Test” in Documents library.

Teams
Teams with default channel, General and new channel, Test

 

SharePoint Team site
SharePoint view of the Channels

 

Sending Emails:

  • To send an email to Microsoft Teams and store it in SharePoint, click on three dots and select “Get Email address”

Get Email address

  • Copy the email address and send email to the address.

Copy Email address

  • To see and control who can send email to this address, click on “Advanced settings”. I have selected to allow email only from members of team.

Email settings

  • Once the email is sent, it is shown in Conversation tab of the channel.

Incoming email

  • In SharePoint, they are saved in folder called “Email Messages”. So, the navigation path will be Documents – > Channel named folder – > Email Messages folder – > Email and their attachments

Email messages folder

 

Adding SharePoint document library from another site:

We can also show and use other SharePoint site’s document library as a tab in the channel

  • Click on plus icon to add document library as a tab in a channel

Add tab

  • Select document library

Document Library

  • Provide the SharePoint site url or the library url.
  • Pick up a document library from list of libraries shown

SharePoint site URL

  • Name the tab

Naming tab

  • Document library is added as a tab aa shown below

Added Tab

 

Not only libraries, we can also show the pages of the SharePoint site associated to the teams and any website (SharePoint website)

Adding SharePoint page as a tab in a channel

  • Click on plus sign to add a tab and select SharePoint
  • Select the page

Page

  • Page is added as a tab as shown bslow

Page in Teams

Adding SharePoint site as a tab in a channel

  • Click on plus symbol and select website
  • Provide a name for tab and the url of SharePoint site or any site

 

Sharepoint swebsite

 

  • SharePoint site is added as a tab as depicted below

SharePoint site as tab

 

NOTE: Deleting the Channel will not delete the folder in SharePoint. All our documents and emails are still can be accessed in SharePoint.

The Standard View of your list is being displayed because your browser does not support running ActiveX controls


SCENARIO:

When we open a Datasheet view in SharePoint, it displays it in Standard view with the error “The Standard View of your list is being displayed because your browser does not support running ActiveX controls.” as shown below.

Error

SOLUTION – 1:

  • In Internet Explorer, click on settings(Gear wheel symbol) and select Compatibility View settingsCompatibility view
  • Check “Display Intranet sites in Compatibility view” and hit close button

Compatibility settings

  • Refresh the Datasheet view with error to see the magic 😛

SOLUTION – 2:

NOTE: To apply this solution, close all the open windows and programs except IE.

  • In Internet Explorer, click on settings(Gear wheel symbol) and select Internet Options
  • Click on Advanced tab and hit Reset Button

Reset

  • Now, open the datasheet view with error.
  • If it does not work, restart the system after resetting IE and open the datasheet view to see it working!