Skip to content

items.GetSiteByName

Overview

This is the "GetSiteByName method" of the "Items Object". It gets site information based on the specified site name.

Limitations

1.5.10.0

  1. When run by a user who does not have the "Site Administration Permission" for the site to get (excluding Privileged Users), SiteSettings (the site settings, such as the labels and choices of the items) cannot be retrieved. This also applies to tenant managers who do not have the "Site Administration Permission". Site information such as SiteId and Title can be retrieved. In processing that refers to SiteSettings, make sure that it has a value before using it.

Prerequisites

  1. This function searches for the "site name" of a site. Please set the site name in advance. Please note that it is not the "Title" of the site.
    Where the "Site name" of a site is set

Syntax

items.GetSiteByName(name)

Parameters

Parameter Type Required Description
name object Yes Specify the site name

Return Value

Return an array of "apiModel" for the corresponding site.

In version 1.5.10.0 and later, the API key in the AI integration settings of SiteSettings is masked (********).

Usage Examples

The following example gets site information for the site named "DepartmentMaster."

const sites = Array.from(items.GetSiteByName('DepartmentMaster'));
if (sites.length) {
    sites.forEach(site => {
        context.Log(site.SiteId);
        context.Log(site.Title);
        context.Log(site.ReferenceType);
    });
}

Supported Versions

Supported Version Details
1.5.10.0 and later Changed so that SiteSettings cannot be retrieved when run by a user without the "Site Administration Permission"