SharePoint – Quick Edit – Missing Required Columns

Leave a comment

Have you ever tried to perform a quick edit on a SharePoint list and get the “Sorry, you can’t create a new item with Quick Edit because this view is missing one or more required columns. To create a new item, please click “New Item” or add required columns to this view.”?

QuickEditMissingRequiredColumn

You checked and indeed, your list contains a required column.

One of the main offenders is the missing “Name” field in the view. I found a method to get rid of this error without needing to add the “Name” field to your view via PowerShell.

Resolution:

#Get the site

$Web = Get-SPWeb -Identity “http://<Your Portal>/<Your Site>”

#Get the list that you need to work with – In my example below my list is called “Assets”

$List = $Web.Lists[“My Custom List”]

#To see the “Name” field

$List.Fields | Select Title, InternalName, Required | Sort Title

#It should look similar to this

RequiredNameField

#Change the field to not required and update

$Field = $List.Fields[“Name”]

$Field.Required = $False

$Field.Update($True)

Here’s a screenshot of what worked for me.SetNameField

That’s it!

Thanks for reading!

Advertisements

Create Office 365 Groups Naming Policy

Leave a comment

As we see greater interest from our clients in Teams, I’ve turned my attention to Office 365 groups administration, specifically on groups naming policy.

To create a naming policy for groups in your Office 365 tenant, you’ll need to use PowerShell.

I followed these instructions to view the current naming policy settings in my tenant by typing the following command:

$Setting = Get-AzureADDirectorySetting -Id (Get-AzureADDirectorySetting | where -Property DisplayName -Value “Group.Unified” -EQ).id

I expected to get some values, but I got this wonderful error instead:

O365GroupNamingPolicySettingsError

So, where did I go from here?

I started to breakdown the command above, by running just the Get-AzureDirectorySetting.

It returned nothing. This tells me that there are no settings currently in place.

So, I had to configure the groups settings in my Office 365 tenant.

To do that, I could get the available template IDs by typing Get-AzureAdDirectorySettingTemplate or use the DisplayName value for “Group.Unified”

AzureADTemplateSettings

To Create a Naming Policy

I followed these steps to complete the creation of my naming policy:

  1. Create a new settings object for the Group.Unified template
  2. Configure the object to allow guests access (You could apply additional settings or leave this step out completely.)
  3. Set my settings to the new object

GroupsSettings

I applied the groups naming policy as seen in the below screenshot.

O365GroupNamingPolicySettings2

 

In OWA, I could see the new settings in effect. Be sure to use an account not in these administrator roles: Global Admin, Partner Tier 1 and 2 Support, User Account Admin, or Directory Writers to test the policy.

O365GroupNameOWA

In summary, creating a naming policy can help users identify and categorize groups in the address book and enforces a consistent naming standard for Office 365 groups in your organization.

The naming policy is applied to groups created in Outlook, Microsoft Teams, SharePoint, Planner, Microsoft Stream, Dynamics 365 for Customer Engagement, Power BI, and many others.

Azure Active Directory (Azure AD) attributes are used in the creation of this policy. The supported attributes are [Department], [Company], [Office], [StateOrProvince], [CountryOrRegion], and [Title].

If you include these attributes in your naming policy, keep in mind that the total length of these prefixes and suffixes is restricted to 53 characters.

Thanks for reading!

Back Up All Azure Rights Management Templates via PowerShell

Leave a comment

I need to update properties of several custom templates in my tenant. After reading the warning in Set-AadrmTemplateProperty (see excerpt below), I want to ensure that I have at least a last-known-good set of these templates.

Excerpt from article:

Important: When you update properties of a custom template, the existing settings for those properties will be overwritten (not supplemented) without warning, so be sure to specify all the settings that you need for the properties that you are updating.

As a best practice, back up the existing template before you run this cmdlet, by using the Export-AadrmTemplate cmdlet. Then, if you need to revert to the original configuration, you can use the Import-AadrmTemplate cmdlet to restore the template.

The Export-AadrmTemplate article provides an example of how to export (back up) one template. Well, I don’t want to do this (one at a time) for all the templates I have in my tenant. So, I wrote the following script to export all templates that I need.

$ShortDate = Get-Date -Format yyyyMMdd

$OutPath = “C:\Azure RMS\Backup\”

$OutFolder = New-Item -ItemType Directory -Force -Path $OutPath$ShortDate

Foreach ($Template in ($Templates = Get-AadrmTemplate))

{

    $TemplateName = $Template.Names[0]

    $TemplateStatus = $Template.Status

    If ($TemplateName -match “1033” -and $TemplateStatus -match “Published”)

{

        $RMSTemplateFileName = ($TemplateName.Value.Substring(0) -replace ” “,“” -replace “\\”,“” -replace “-“,“”)

        $OutFile = $($OutFolder)\$($RMSTemplateFileName).xml”

        Export-AadrmTemplate -TemplateId $Template.TemplateId -Path $OutFile -Force

}

}

Get-Variable | Remove-Variable -EA 0

Get-PSSession | Remove-PSSession

 

The script creates a new directory and writes the export files to it in case I need to run this frequently.

Obviously, the If statement and any of the variables can be changed to meet your needs.

This script works well for me.

Thanks for reading!

Automating Site Directory in SharePoint 2013

Leave a comment

A while ago I posted on how to display Sites or Site Collections using Content Search Web Part here.

Well, since CSWP periodically displays “Sorry, something went wrong”, users are not happy with this solution.

So, I wrote a PowerShell script to update a list called “Site Directory”, and placed it on the home page.  I then added one additional logic to get new site collections created from the previous day.  After adding the script to Task Scheduler, I didn’t have to worry about missing newly created site collections.

To get all of the site collections created from the previous day, I used:


$Today = [DateTime]::Today
$Yesterday = $Today.AddDays(-1)

$siteCollections = Get-SPWebApplication http://demosite.vee.local | Get-SPSite -limit ALL | where {$_.RootWeb.Created -ge $Yesterday}

Now keep in mind, $Today will return today’s date at midnight and the same goes for $Yesterday (yesterday’s date at midnight).  I pointed this out to make sure that when you schedule this script in the Task Scheduler, you set it to run accordingly.  And, of course, replace the Web application with your Web application.

Writing it to a list was pretty straightforward, I added a category to the list, so I would have an additional option to display different views on the page.

In this list (Site Directory), there’s a hyperlink column.  I wanted the users to click on the hyperlink using a display name instead of the URL.  So, the $hyperlink in the script, will display the “friendly name”(ex: Coffee Beans) instead of the URL (ex: http://demosite.vee.local/dept/coffee%20beans).


foreach($siteCollection in $siteCollections)
{
  $web=$siteCollection.Rootweb;

  $web.Title + "," + $siteCollection.Url + "," + $web.Created | Out-File -Encoding Default -Append -FilePath $outFile;
  
  $siteCollection.Dispose()
};

$newItem = @{}
$sites = Import-Csv -path $outFile

$web = Get-SPWeb "http://demosite.vee.local";
$list = $web.GetList("http://demosite.vee.local/lists/Site Directory");

foreach($site in $sites)
{
  $siteURL =  $site.URL
  
  if($siteURL -match "/apps/")
  {
    $category = "APPS"
  }
  elseif($siteURL -match "/dept/")
  {
    $category = "DEPT"
  }
  else
  {
    $category = "DEFAULT"
  }
    $newItem = $list.items.Add();
    $newItem["Title"] = $site.'Title'
    $hyperlink = $site.URL + ", " + $site.Title
    $newItem["SiteURL2"] = $hyperlink
    $newItem["Category"] = $category
        
  #$newItem.Update();
  $web.Dispose();
};

Well, since I made this change, the users are happy.  No complaints! 🙂