当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] 如何在现代 SharePoint Online 网站中创建日历列表?

作者:精品下载站 日期:2024-12-14 16:03:44 浏览:17 分类:玩电脑

如何在现代 SharePoint Online 网站中创建日历列表?


要求:在 SharePoint Online 中创建日历列表。

如何在 SharePoint Online 中创建日历?

SharePoint Online 日历列表提供了一种方便且直观的方式来组织会议和活动。您可以按每日、每周和每月视图显示日历列表。将日历添加到 SharePoint Online 现代网站有点棘手,因为它已移动到“经典应用程序”下。要在 SharePoint Online 中创建日历列表,请执行以下步骤:

  1. 登录到您的 SharePoint Online 现代网站 >> 单击“新建”工具栏 >> 选择“应用程序”。

    [玩转系统] 如何在现代 SharePoint Online 网站中创建日历列表?

  2. 在 SharePoint 应用程序页面上,单击“经典体验”链接。这将带您进入经典应用程序页面。 (网址快捷方式:https://YourDomain.sharepoint.com/sites/Your-Site/_layouts/15/addanapp.aspx)。

    [玩转系统] 如何在现代 SharePoint Online 网站中创建日历列表?

  3. 向下滚动(或搜索)并选择“日历”应用程序。

    [玩转系统] 如何在现代 SharePoint Online 网站中创建日历列表?

  4. 输入日历的名称,然后单击“创建”。

    [玩转系统] 如何在现代 SharePoint Online 网站中创建日历列表?

现在,您已在 SharePoint Online 新式网站上创建了一个日历列表。

SharePoint Online:使用 PowerShell 创建日历

让我们使用 PnP PowerShell 在 SharePoint Online 中创建日历:


#Parameters
$SiteURL = "https://crescent.sharepoint.com"
$CalendarName = "Firm Events" 

Try { 
    #Connect to PnP Online
    Connect-PnPOnline -Url $SiteURL -Interactive
 
    #Get the File
    $Calenar = New-PnPList -Title $CalendarName -Template Events -ErrorAction Stop
    Write-host "Calendar List Added to the Site!" -f Green
    }
Catch {
    write-host -f Red "`tError:" $_.Exception.Message
}

使用 PowerShell CSOM 在 SharePoint Online 中创建日历列表

以下是在 SharePoint Online 中添加新日历列表的 CSOM 方法:


#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"

#Parameters
$SiteURL = "https://Crescent.sharepoint.com/sites/Events"
$CalendarName = "Firm Events"

Try {
    #Get Credentials to connect
    $Cred = Get-Credential
 
    #Setup the context
    $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
    $Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password)

    #Create a Calendar
    $ListInfo = New-Object Microsoft.SharePoint.Client.ListCreationInformation
    $ListInfo.Title = $CalendarName
    $ListInfo.TemplateType = 106
    $List = $Ctx.web.Lists.Add($ListInfo)
    $List.Description = $ListTitle
    $List.Update()
    $Ctx.ExecuteQuery()

    Write-host "Calendar List Added to the Site!" -f Green
}
Catch {
    write-host -f Red "`tError:" $_.Exception.Message
}

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯