sharepoint-v1-api


Namesharepoint-v1-api JSON
Version 0.1.4 PyPI version JSON
download
home_page
Summary
upload_time2023-08-02 20:15:30
maintainer
docs_urlNone
authorAske Bluhme Klok
requires_python>=3.6.8
licenseMIT
keywords sharepoint
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # sharepoint_v1_api

Version 0.1.4

# Setup


```python
from sharepoint_api.SharePointAPI import SharePointAPI as SP

creds = {
    "username": "",
    "password": "",
    "sharepoint_url": "",
    'proxies': {}
}

sp = SP._compact_init(creds)
```

## Get lists in a sharepoint_site
```python
# Get an overview of all lists in a sharepoint_site
sharepoint_site_name = "NAME_OF_YOUR_SITE"
sp_lists = sp.get_lists(sharepoint_site_name)
print(sp_lists)

# Load one of the lists by name
list_name = 'Sager'
cases_list = sp_lists.get_list(list_name)
print(cases_list.Title)
```

# Get items in a list
```python
# When loading a list the top 1000 items will be retrieved
sharepoint_site_name = "NAME_OF_YOUR_SITE"
list_name = 'Sager'
cases_list = sp.get_list_by_name(sharepoint_site_name, list_name)
print(cases_list.all_items)

# If the list is contains more items, it may be necesarry to use a filter
# Filters can be formatted as shown below
filters = ' and '.join([
        "(TeamId == '3')",
        "(Status == '11 - Modtaget')",
        "((Status != '90 - Lukket') and (Status != '91 - Afvist') and (Status != '92 - Duplikeret') and (Status != '93 - Annulleret'))"
        ])
cases_list = sp.get_list_by_name(sharepoint_site_name, list_name, filters)
print(cases_list.all_items)
```

# Add certificates files to a certificate list
```python
# Set sharepoint_site name
sharepoint_site_name = "NAME_OF_YOUR_SITE"

# Set name of certificates (use Certifikater if danish)
list_name = 'Certificates'
cert_list = sp.get_list_by_name(sharepoint_site_name, list_name)

# The certificate metadata (such as name, expiry date and such)
data = {
 "Title": "My Certificate Name",
 "ExpiryDate": "2020-11-25"
}

# Create the certificate item
item = sp.create_item(sharepoint_site_name, cert_list, data)

# Attach the file
file_name = 'my_file.txt'
file_path = 'path/to/my_file.txt'
item.attach_item(file_name, file_path)


# Attach another file
file_name = 'mysecondfile.txt'
file_path = 'path/to/mysecondfile.txt'
attach_file("mysecondfile.txt", sharepoint_site_name, cert_list, item)
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "sharepoint-v1-api",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6.8",
    "maintainer_email": "",
    "keywords": "Sharepoint",
    "author": "Aske Bluhme Klok",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/21/75/c08a7ee7d2b1ddacc3960ac0eaac1e9382255aed6fb0ef202f754f205120/sharepoint_v1_api-0.1.4.tar.gz",
    "platform": null,
    "description": "# sharepoint_v1_api\n\nVersion 0.1.4\n\n# Setup\n\n\n```python\nfrom sharepoint_api.SharePointAPI import SharePointAPI as SP\n\ncreds = {\n    \"username\": \"\",\n    \"password\": \"\",\n    \"sharepoint_url\": \"\",\n    'proxies': {}\n}\n\nsp = SP._compact_init(creds)\n```\n\n## Get lists in a sharepoint_site\n```python\n# Get an overview of all lists in a sharepoint_site\nsharepoint_site_name = \"NAME_OF_YOUR_SITE\"\nsp_lists = sp.get_lists(sharepoint_site_name)\nprint(sp_lists)\n\n# Load one of the lists by name\nlist_name = 'Sager'\ncases_list = sp_lists.get_list(list_name)\nprint(cases_list.Title)\n```\n\n# Get items in a list\n```python\n# When loading a list the top 1000 items will be retrieved\nsharepoint_site_name = \"NAME_OF_YOUR_SITE\"\nlist_name = 'Sager'\ncases_list = sp.get_list_by_name(sharepoint_site_name, list_name)\nprint(cases_list.all_items)\n\n# If the list is contains more items, it may be necesarry to use a filter\n# Filters can be formatted as shown below\nfilters = ' and '.join([\n        \"(TeamId == '3')\",\n        \"(Status == '11 - Modtaget')\",\n        \"((Status != '90 - Lukket') and (Status != '91 - Afvist') and (Status != '92 - Duplikeret') and (Status != '93 - Annulleret'))\"\n        ])\ncases_list = sp.get_list_by_name(sharepoint_site_name, list_name, filters)\nprint(cases_list.all_items)\n```\n\n# Add certificates files to a certificate list\n```python\n# Set sharepoint_site name\nsharepoint_site_name = \"NAME_OF_YOUR_SITE\"\n\n# Set name of certificates (use Certifikater if danish)\nlist_name = 'Certificates'\ncert_list = sp.get_list_by_name(sharepoint_site_name, list_name)\n\n# The certificate metadata (such as name, expiry date and such)\ndata = {\n \"Title\": \"My Certificate Name\",\n \"ExpiryDate\": \"2020-11-25\"\n}\n\n# Create the certificate item\nitem = sp.create_item(sharepoint_site_name, cert_list, data)\n\n# Attach the file\nfile_name = 'my_file.txt'\nfile_path = 'path/to/my_file.txt'\nitem.attach_item(file_name, file_path)\n\n\n# Attach another file\nfile_name = 'mysecondfile.txt'\nfile_path = 'path/to/mysecondfile.txt'\nattach_file(\"mysecondfile.txt\", sharepoint_site_name, cert_list, item)\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "",
    "version": "0.1.4",
    "project_urls": null,
    "split_keywords": [
        "sharepoint"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2175c08a7ee7d2b1ddacc3960ac0eaac1e9382255aed6fb0ef202f754f205120",
                "md5": "a7dac238cb1b0a5f593d413705aa7c69",
                "sha256": "820a809f02d396f8da9429d6508bb8064143a292c3d577f6113ef1a260bcb07e"
            },
            "downloads": -1,
            "filename": "sharepoint_v1_api-0.1.4.tar.gz",
            "has_sig": false,
            "md5_digest": "a7dac238cb1b0a5f593d413705aa7c69",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6.8",
            "size": 10244,
            "upload_time": "2023-08-02T20:15:30",
            "upload_time_iso_8601": "2023-08-02T20:15:30.908167Z",
            "url": "https://files.pythonhosted.org/packages/21/75/c08a7ee7d2b1ddacc3960ac0eaac1e9382255aed6fb0ef202f754f205120/sharepoint_v1_api-0.1.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-02 20:15:30",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "sharepoint-v1-api"
}
        
Elapsed time: 0.09600s