{"id":23058667,"url":"https://github.com/suhdev/stickyants-sp-util","last_synced_at":"2025-07-27T14:09:08.002Z","repository":{"id":57142845,"uuid":"161404876","full_name":"suhdev/stickyants-sp-util","owner":"suhdev","description":"A set of utility functions and classes for SharePoint Online, SharePoint 2013, 2016 development to simplify working with JSOM.","archived":false,"fork":false,"pushed_at":"2018-12-12T01:09:18.000Z","size":83,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-08T12:31:31.779Z","etag":null,"topics":["jsom","sharepoint","termstore","utilities"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/suhdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-11T23:04:01.000Z","updated_at":"2018-12-12T01:11:56.000Z","dependencies_parsed_at":"2022-09-05T18:41:36.409Z","dependency_job_id":null,"html_url":"https://github.com/suhdev/stickyants-sp-util","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/suhdev/stickyants-sp-util","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhdev%2Fstickyants-sp-util","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhdev%2Fstickyants-sp-util/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhdev%2Fstickyants-sp-util/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhdev%2Fstickyants-sp-util/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/suhdev","download_url":"https://codeload.github.com/suhdev/stickyants-sp-util/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhdev%2Fstickyants-sp-util/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267368932,"owners_count":24076093,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jsom","sharepoint","termstore","utilities"],"created_at":"2024-12-16T02:16:55.424Z","updated_at":"2025-07-27T14:09:07.984Z","avatar_url":"https://github.com/suhdev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# stickyants-sp-util \n\nA set of utility functions and classes to support SharePoint development using JSOM. \nThe library simplifies some of the tasks and uses ES6 promises to wrap `executeQueryAsync` calls\nsuch that they work nicely together. \n\n## 1 Term Store (Taxonomy)\n\n### 1.1 Working with the term store \n\n```javascript \n\nimport {createTermStore} from 'stickyants-sp-util'; \n\n\nvar store = createTermStore(); \n\n//to get all terms of a term set\nvar terms = await store.getAllTermsByTermSetId('11365da4-d7cd-43b3-9d28-9d43b0313f2f'); \n\n```\n\n## 2 Link Generation\n\n\n### 2.1 Generate link to user picture by user email address\n\n```javascript \n\nimport {getUserPictureLink} from 'stickyants-sp-util'; \n\n\nvar pictureUrl = getUserPictureLink('someuser@sometenant.com');\n\n```\n\n### 2.2 Generate delve profile of user by email user email address\n\n```javascript \n\nimport {getUserDelveLink} from 'stickyants-sp-util'; \n\n\nvar delveLink = getUserDelveLink('someuser@sometenant.com');\n\n```\n\n### 2.3 Generate a link to specific version of the current page using UI Version \n\n```javascript \n\nimport {createVersionLink} from 'stickyants-sp-util'; \n\n//first major version link \nvar delveLink = createVersionLink(512);\n\n```\n\n\n## 3 Using async/await to work with JSOM \n\n```javascript \n\nimport {executeOnContext} from 'stickyants-sp-util'; \n\n\nvar ctx = new SP.ClientContext();\nvar web = ctx.get_web(); \nctx.load(web); \nawait executeOnContext(ctx); \nconsole.log(web.get_title()); \n\n```\n\n## 4 Working with folders\n\n### 4.1 Creating a nested folder structure in SharePoint list \n\n```javascript \n\nimport {createFolderInListIfNotExist} from 'stickyants-sp-util'; \n\nvar ctx = new SP.ClientContext();\nvar web = ctx.get_web(); \nvar pages = web.get_lists().getByTitle('Pages'); \nvar folder = await createFolderInListIfNotExist(ctx,pages,'folder1/folder2/folder3');//returns folder3\n\n```\n\n### 4.2 Check if folder exists in List \n\n```javascript \n\nimport {folderExistsInList} from 'stickyants-sp-util'; \n\nvar ctx = new SP.ClientContext();\nvar web = ctx.get_web(); \nvar pages = web.get_lists().getByTitle('Pages'); \nvar result = await folderExistsInList(ctx,pages,'folder3'); //returns true/false\n\n```\n\n## 5 Publishing Infrastructure \n\n### 5.1 Creating a publishing page\n\n```javascript \n\nimport {createPublishingPage} from 'stickyants-sp-util'; \n\nvar ctx = new SP.ClientContext();\nvar result = await createPublishingPage(ctx,'somfile','My Content Type Name'); \n\n```\n\n### 5.2 Getting page layout that is associated with a specific content type \n\n```javascript \n\nimport {getPageLayoutItemByAssociatedContentType} from 'stickyants-sp-util'; \n\nvar ctx = new SP.ClientContext();\nvar result = await getPageLayoutItemByAssociatedContentType(ctx,'My Content Type Name'); \n\n```\n\n## 6 SharePoint Error Codes (JSOM)\n\n```javascript \n\n/**\n * JSOM error codes, the possible values of error codes that JSOM \n * can return \n */\nexport enum SPErrorCode {\n    /**\n     * The accessed item has been deleted\n     */\n    ItemDoesNotExist = -2147024809,\n    /**\n     * Some unknown error\n     */\n    GenericError = -1,\n    /**\n     * User does not have permission to access/perform operation \n     */\n    AccessDenied = -2147024891,\n    /**\n     * A document with the same name already exist and the user is attempting to add new file/folder\n     */\n    DocAlreadyExists = -2130575257,\n    /**\n     * A version that is more recent has been saved \n     */\n    VersionConflict = -2130575339,\n    /**\n     * List item is in recycle bin \n     */\n    ListItemDeleted = -2130575338,\n    /**\n     * A field value that has been provided is invalid\n     */\n    InvalidFieldValue = -2130575155,\n    /**\n     * Operation not supported\n     */\n    NotSupported = -2147024846,\n    /**\n     * \n     */\n    Redirect = -2130575152,\n    /**\n     * \n     */\n    NotSupportedRequestVersion = -2130575151,\n    /**\n     * A specific field validation has failed \n     */\n    FieldValueFailedValidation = -2130575163,\n    /**\n     * Item update failed validation rules\n     */\n    ItemValueFailedValidation = -2130575162,\n}\n\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuhdev%2Fstickyants-sp-util","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuhdev%2Fstickyants-sp-util","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuhdev%2Fstickyants-sp-util/lists"}