Tag Archives: Code Snippet

PowerShell script to hide or display form fields

Hide or show fields in New or Edit forms

SharePoint Customise Form Menu

Microsoft has made it easier to customise “modern” SharePoint Online Lists and Libraries Forms natively.

But what do you do if you need to managing list is “classic” Form or the edit for option is just not available?

One option is to write a PowerShell script, see example below which will hide or show fields within New or Edit Forms.

This code and other scripts can be accessed in GitHub.

For more information on customising Modern SharePoint Forms, see these Microsoft articles:

Siôn Lewis

21/12/2016

This is based upon my original UnitTestMethod.Snippet Gist, this C# Code Snippet can be used within Visual Studio to generates Asynchronous Unit Test Methods (Functions).

How to Use

  1. Save the Code Snippet file as UnitTestMethod.Snippet
  2. For for VS 2015, move the UnitTestMethod.Snippet file into this directory: %userprofile%\Documents\Visual Studio 2015\Code Snippets\Visual C#\My Code Snippets
  3. Once installed type: utestasync + [Tab] + [Tab]
[TestMethod]
public void MethodName_Condition_ExpectedResult()
{
 // Arrange


 // Act
 var result = await Task.FromResult<object>(null);

 // Assert
 Assert.Fail();
 
}

Code Snippet: Unit Test Methods

Siôn Lewis

19/12/2016

While researching Unit Testing, I reviewed several different C# Code Snippet examples for generating Unit Test Methods (Functions) within Visual Studio and this is my take on it…

How to Use

  1. Save the Code Snippet file as UnitTestMethod.Snippet
  2. For for VS 2015, move the UnitTestMethod.Snippet file into this directory: %userprofile%\Documents\Visual Studio 2015\Code Snippets\Visual C#\My Code Snippets
  3. Once installed type: utest + [Tab] + [Tab]
[TestMethod]
public void MethodName_Condition_ExpectedResult()
{
 // Arrange


 // Act


 // Assert
 Assert.Fail();
 
}

Note: typing testc + [Tab] + [Tab] will generate a new empty Unit Test Class

Code Snippet: Async Unit Test Methods