Enable external site content using client side object model on SharePoint sites in tenant.

Background

Adding content to SharePoint’s Online Modern sites is easily done using SharePoint’s built in “Embed” web part. The Webpart does have a few limitations though. Firstly, the default behaviour for displaying external content is only limited to sites that have been added to the “Secure Sites” list. And, although site administrators are able to control what external content is allowed on the site, all new external domains must be explicitly added by administrators to the Secure Sites List each time.… [Keep reading] “Enable external site content using client side object model on SharePoint sites in tenant.”

Quality of life user experience improvements to SharePoint Online through the use of 301 redirects and Azure App Service

Originally posted on Lucian.Blog. Follow Lucian on Twitter, @LucianFrango.

***

This is the third time in the last year that I’ve had to setup a HTTP 301 redirect in Azure for a customer.Doing so improves the general quality of life experience for users accessing various Microsoft 365 services, like for example specific SharePoint Online team sites, or Exchange Online OWA.

With each implementation I turned to Azure App Service to deliver the functionality needed.… [Keep reading] “Quality of life user experience improvements to SharePoint Online through the use of 301 redirects and Azure App Service”

Query multiple object classes from AD using LDAP Query

Recently I had to make a query to the Active Directory to get the list of users and contacts. To achieve this, I used the LDAP query. See the following function:

 ///<summary>
/// Queries the Active Directory using LDAP
///</summary>
///<param name="entry">Directory entry</param>
///<param name="search">Directory searcher with properties to load and filters</param>
///<returns>A dictionary with ObjectGuid as the key</returns>
public static Dictionary<string, SearchResult> QueryLDAP(DirectoryEntry entry, DirectorySearcher search)
{
    entry.AuthenticationType = AuthenticationTypes.SecureSocketsLayer;
    entry.Path = ConfigurationManager.AppSettings["LDAP.URL"].ToString();
    entry.Username = ConfigurationManager.AppSettings["LDAP.Username"].ToString();
    entry.Password = ConfigurationManager.AppSettings["LDAP.Password"].ToString();
    /// Load any attributes you want to retrieve
    search.SearchRoot = entry;
    search.PropertiesToLoad.Add("name");
    search.PropertiesToLoad.Add("telephonenumber");
    search.PropertiesToLoad.Add("mobile");
    search.PropertiesToLoad.Add("mail");
    search.PropertiesToLoad.Add("title");
    search.PropertiesToLoad.Add("department");
    search.PropertiesToLoad.Add("objectguid");
    search.PropertiesToLoad.Add("sn");
    search.PropertiesToLoad.Add("userAccountControl");
    search.PropertiesToLoad.Add("userPrincipalName");
    search.PropertiesToLoad.Add("msexchhidefromaddresslists");
    search.PropertiesToLoad.Add("samaccountname");
    search.Filter = "(|(ObjectClass=user)(ObjectClass=contact))";
    search.SearchScope = SearchScope.Subtree;
    SearchResultCollection result = search.FindAll();
    Dictionary<string, SearchResult> dicResult = new
    Dictionary<string, SearchResult>();
    foreach (SearchResult profile in result)
    {
       if (profile.Properties["objectGUID"] != null && profile.Properties["objectGUID"].Count > 0)
         {
           Guid guid = new Guid((Byte[])profile.Properties["objectGUID"][0]);
           dicResult.Add(guid.ToString(), profile);
         }
     }
     result.Dispose();
     entry.Close();
     entry.Dispose();
    return dicResult;

}

What this function does is, it queries the Active Directory and returns all profiles (set by filter) in a dictionary object.[Keep reading] “Query multiple object classes from AD using LDAP Query”