共用方式為


SPMeeting.Add method (String, String, UInt32, String, String, String, String, String, Boolean, Int16)

將會議執行個體新增至目前的會議工作區網站。

Namespace:  Microsoft.SharePoint.Meetings
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'宣告
Public Function Add ( _
    organizer As String, _
    uid As String, _
    sequence As UInteger, _
    dateStamp As String, _
    title As String, _
    location As String, _
    dateStart As String, _
    dateEnd As String, _
    nonGregorian As Boolean, _
    <OutAttribute> ByRef nMeetingCount As Short _
) As Integer
'用途
Dim instance As SPMeeting
Dim organizer As String
Dim uid As String
Dim sequence As UInteger
Dim dateStamp As String
Dim title As String
Dim location As String
Dim dateStart As String
Dim dateEnd As String
Dim nonGregorian As Boolean
Dim nMeetingCount As Short
Dim returnValue As Integer

returnValue = instance.Add(organizer, _
    uid, sequence, dateStamp, title, location, _
    dateStart, dateEnd, nonGregorian, _
    nMeetingCount)
public int Add(
    string organizer,
    string uid,
    uint sequence,
    string dateStamp,
    string title,
    string location,
    string dateStart,
    string dateEnd,
    bool nonGregorian,
    out short nMeetingCount
)

參數

  • organizer
    Type: System.String

    string包含會議召集人,指定為email_address@domain.ext的電子郵件地址。此參數用於委派案例。如果會議召集人不代理人,您可以傳遞空字串。在此情況下,執行應用程式的使用者會被視為會議召集人。

  • sequence
    Type: System.UInt32

    修訂序號RFC 2445所指定。順序號碼是從零開始,以及每個版本遞增。序號用於判斷更新的順序,以防未送達順序。更新更低比目前序號,則會捨棄。

  • dateStamp
    Type: System.String

    string代表目前日期與時間。日期及時間必須以來表示以國際標準時間 (UTC) 格式指定由ISO 8601,如下:"yyyyMMdd'T 'HHmmss' Z'"。

  • dateStart
    Type: System.String

    string表示的日期和時間,開始排定會議。日期及時間必須以來表示以國際標準時間 (UTC) 格式指定由ISO 8601,如下:"yyyyMMdd'T 'HHmmss' Z'"。

  • dateEnd
    Type: System.String

    string表示的日期和結束排定會議的時間。必須晚於dateStart的日期和時間。此值必須以國際標準時間 (UTC) 表示格式如下指定ISO 8601,:"yyyyMMdd'T 'HHmmss' Z'"。

  • nonGregorian
    Type: System.Boolean

    true行事曆設為西曆 ; 以外的格式否則,請false。

  • nMeetingCount
    Type: System.Int16

    將會收到總數與目前的會議工作區網站相關聯的會議執行個體的變數參照。

傳回值

Type: System.Int32
會議的執行個體識別碼。

備註

Add方法會在會議工作區網站中建立新的會議執行個體。約會不會新增至SharePoint Foundation行事曆。

Examples

下列範例會為主控台應用程式,會建立會議工作區網站,並將會議執行個體新增至網站。

Imports System
Imports Microsoft.SharePoint
Imports Microsoft.SharePoint.Meetings

Module ConsoleApp
   Sub Main()
      Using site As SPSite = New SPSite("https://localhost")
         Using web As SPWeb = site.OpenWeb()

            ' Set up meeting parameters.
            Dim dtStart As DateTime = DateTime.Now.AddDays(6)
            Dim stamp As String = ISO8601BasicDate(DateTime.Now)
            Dim startTime As String = ISO8601BasicDate(dtStart)
            Dim endTime As String = ISO8601BasicDate(dtStart.AddHours(1))

            Dim title As String = "Test Sharepoint"
            Dim location As String = "Your office"
            Dim organizer As String = String.Empty
            Dim uid As String = Guid.NewGuid().ToString("N")
            Dim sequence As System.UInt32 = 0

            ' Create an output variable.
            Dim meetingCount As Short

            ' Create a Meeting Workspace site.
            Dim mwsWeb As SPWeb = CreateWorkspace(web, "Test", "Test Workspace", "A test workspace", "MPS#0")

            ' Get the meeting information for the workspace.
            Dim meetingInfo As SPMeeting = SPMeeting.GetMeetingInformation(mwsWeb)

            ' Add the meeting.
            Dim instanceID As Integer = meetingInfo.Add(organizer, uid, sequence, stamp, _
                                                        title, location, startTime, endTime, _
                                                        False, meetingCount)
            ' Clean up.
            mwsWeb.Dispose()

            ' Print the URL and number of meetings.
            Dim url As String = mwsWeb.Url + "?InstanceID=" + instanceID.ToString()
            Console.WriteLine(url)
            Console.WriteLine("Meeting count = {0}", meetingCount)

         End Using
      End Using
      Console.Write(vbCrLf + "Press ENTER to continue...")
      Console.ReadLine()
   End Sub

   Function CreateWorkspace(ByRef webSite As SPWeb, ByVal url As String, _
                            ByVal title As String, ByVal description As String, _
                            ByVal template As String) As SPWeb
      Dim mws As SPWeb = Nothing
      Try
         mws = webSite.Webs.Add(url, title, description, _
                                CType(webSite.Locale.LCID, System.UInt32), template, _
                                False, False)
      Catch
         If SPMeeting.IsMeetingWorkspaceWeb(webSite.Webs(url)) Then
            mws = webSite.Webs(url)
         End If
      End Try
      Return mws
   End Function

   Function ISO8601BasicDate(ByVal dt As DateTime) As String
      Dim format As String = "yyyyMMdd'T'HHmmss'Z'"
      Dim dtUTC As DateTime = dt.ToUniversalTime()
      Return dtUTC.ToString(format, System.Globalization.DateTimeFormatInfo.InvariantInfo)
   End Function

End Module
using System;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Meetings;

namespace Test
{
   class ConsoleApp
   {
      static void Main(string[] args)
      {
         using (SPSite site = new SPSite("https://localhost"))
         {
            using (SPWeb web = site.OpenWeb())
            {
               // Define meeting parameters.
               DateTime dtStart = DateTime.Now.AddDays(5);
               string stamp = ISO8601BasicDate(DateTime.Now);
               string startTime = ISO8601BasicDate(dtStart);
               string endTime = ISO8601BasicDate(dtStart.AddHours(1));
               string title = "Test Sharepoint";
               string location = "Your office";
               string organizer = String.Empty;
               uint sequence = 0;
               string uid = Guid.NewGuid().ToString("N");

               // Create an output variable.
               short meetingCount;

               // Create a Meeting Workspace site.
               SPWeb mwsWeb = CreateWorkspace(web, "Test", "Test Workspace", "A test workspace", "MPS#0");

               // Get the meeting information for the workspace.
               SPMeeting meetingInfo = SPMeeting.GetMeetingInformation(mwsWeb);

               // Add the meeting.
               try
               {
                  int instanceID = meetingInfo.Add(organizer, uid, sequence,
                                               stamp, title, location,
                                               startTime, endTime, false,
                                               out meetingCount);

                  // Print the URL and number of meetings.
                  string url = mwsWeb.Url + "?InstanceID=" + instanceID.ToString();
                  Console.WriteLine(url);
                  Console.WriteLine("Meeting count = {0}", meetingCount);
               }
               catch (SPException ex)
               {
                  Console.WriteLine(ex.Message);
               }

               // Clean up.
               mwsWeb.Dispose();
            }
         }
         Console.Write("\nPress ENTER to continue...");
         Console.ReadLine();
      }

      static SPWeb CreateWorkspace(SPWeb webSite, string url, string title,
                                   string description, string template)
      {
         SPWeb mws = null;
         try
         {
            mws = webSite.Webs.Add(url, title, description,
                                   (uint)webSite.Locale.LCID, template,
                                   false, false);
         }
         catch (SPException) // A site of that name already exists.
         {
            if (SPMeeting.IsMeetingWorkspaceWeb(webSite.Webs[url]))
               mws = webSite.Webs[url];
         }
         return mws;
      }

      static string ISO8601BasicDate(DateTime dt)
      {
         string format = "yyyyMMdd'T'HHmmss'Z'";
         DateTime dtUTC = dt.ToUniversalTime();
         return dtUTC.ToString(format, System.Globalization.DateTimeFormatInfo.InvariantInfo);
      }

   }
}

請參閱

參照

SPMeeting class

SPMeeting members

Add overload

Microsoft.SharePoint.Meetings namespace

MeetingCount

InstanceId

Update(String, UInt32, String, String, String, String, String, Boolean)