コード例 #1
0
        public void AddSiteComponents()
        {
            // Create site columns
            CSOMUtil.CreateSiteColumns(clientContext, _siteColumns);

            // Create Content Type "Property" and List "Properties"
            CSOMUtil.CreateContentType(clientContext, "Property", "", "0x0100DA7D2213C0CC4C4782C9C50DE696DB86", new string[] {
                "sl_owner",
                "sl_emailaddress",
                "sl_address1",
                "sl_address2",
                "sl_city",
                "sl_state",
                "sl_postalCode",
                "sl_latitude",
                "sl_longitude",
                "sl_group"
            });
            CSOMUtil.AddSharePointList(clientContext, "0x0100DA7D2213C0CC4C4782C9C50DE696DB86", "Properties", "Lists/Properties", (int)ListTemplateType.GenericList);

            // Create Content Type "Room" and List "Rooms"
            CSOMUtil.CreateContentType(clientContext, "Room", "", "0x0100981711E5CE33481C85F37734423082DB", new string[] {
                "sl_propertyID"
            });
            CSOMUtil.AddSharePointList(clientContext, "0x0100981711E5CE33481C85F37734423082DB", "Rooms", "Lists/Rooms", (int)ListTemplateType.GenericList);
            CSOMUtil.BindLookupField(clientContext, "Rooms", "sl_propertyID", "ID", "Properties");

            // Create Content Type "Inspection" and List "Inspections"
            CSOMUtil.CreateContentType(clientContext, "Inspection", "", "0x01001D53426644A048A7A6E29683A8351143", new string[] {
                "sl_datetime",
                "sl_inspector",
                "sl_emailaddress",
                "sl_propertyID",
                "sl_finalized"
            });
            CSOMUtil.AddSharePointList(clientContext, "0x01001D53426644A048A7A6E29683A8351143", "Inspections", "Lists/Inspections", (int)ListTemplateType.GenericList, true);
            CSOMUtil.BindLookupField(clientContext, "Inspections", "sl_propertyID", "ID", "Properties");

            // Create Content Type "Inspection Comment" and List "Inspection Comments"
            CSOMUtil.CreateContentType(clientContext, "Inspection Comment", "", "0x0100232C3EC9E48A4838983CC2F8FFB3D8E3", new string[] {
                "sl_inspectionID",
                "sl_roomID"
            });
            CSOMUtil.AddSharePointList(clientContext, "0x0100232C3EC9E48A4838983CC2F8FFB3D8E3", "Inspection Comments", "Lists/InspectionComments", (int)ListTemplateType.GenericList);
            CSOMUtil.BindLookupField(clientContext, "Inspection Comments", "sl_inspectionID", "ID", "Inspections");
            CSOMUtil.BindLookupField(clientContext, "Inspection Comments", "sl_roomID", "ID", "Rooms");

            // Create Content Type "Incident" and List "Incidents"
            CSOMUtil.CreateContentType(clientContext, "Incident", "", "0x0100B34132E48D364D4781878210F1663255", new string[] {
                "sl_date",
                "sl_inspectorIncidentComments",
                "sl_dispatcherComments",
                "sl_repairComments",
                "sl_status",
                "sl_repairScheduled",
                "sl_repairCompleted",
                "sl_repairApproved",
                "sl_repairPerson",
                "sl_propertyID",
                "sl_inspectionID",
                "sl_roomID",
                "sl_type",
                "sl_taskId"
            });
            CSOMUtil.AddSharePointList(clientContext, "0x0100B34132E48D364D4781878210F1663255", "Incidents", "Lists/Incidents", (int)ListTemplateType.GenericList);
            CSOMUtil.BindLookupField(clientContext, "Incidents", "sl_propertyID", "ID", "Properties");
            CSOMUtil.BindLookupField(clientContext, "Incidents", "sl_inspectionID", "ID", "Inspections");
            CSOMUtil.BindLookupField(clientContext, "Incidents", "sl_roomID", "ID", "Rooms");

            // Create Content Type "Room Inspection Photo" and Document Lib "Room Inspection Photos"
            CSOMUtil.CreateContentType(clientContext, "Room Inspection Photo", "", "0x010100ECBC5A98AA6F42729342F940B0F10493", new string[] {
                "sl_inspectionID",
                "sl_incidentID",
                "sl_roomID"
            });
            CSOMUtil.AddSharePointList(clientContext, "0x010100ECBC5A98AA6F42729342F940B0F10493", "Room Inspection Photos", "RoomInspectionPhotos", (int)ListTemplateType.DocumentLibrary);
            CSOMUtil.BindLookupField(clientContext, "Room Inspection Photos", "sl_inspectionID", "ID", "Inspections");
            CSOMUtil.BindLookupField(clientContext, "Room Inspection Photos", "sl_incidentID", "ID", "Incidents");
            CSOMUtil.BindLookupField(clientContext, "Room Inspection Photos", "sl_roomID", "ID", "Rooms");

            // Create Content Type "Repair Photo" and Document Lib "Repair Photos"
            CSOMUtil.CreateContentType(clientContext, "Repair Photo", "", "0x010100F15273431C9143FCBA2C914F293399E9", new string[] {
                "sl_inspectionID",
                "sl_incidentID",
                "sl_roomID"
            });
            CSOMUtil.AddSharePointList(clientContext, "0x010100F15273431C9143FCBA2C914F293399E9", "Repair Photos", "RepairPhotos", (int)ListTemplateType.DocumentLibrary);
            CSOMUtil.BindLookupField(clientContext, "Repair Photos", "sl_inspectionID", "ID", "Inspections");
            CSOMUtil.BindLookupField(clientContext, "Repair Photos", "sl_incidentID", "ID", "Incidents");
            CSOMUtil.BindLookupField(clientContext, "Repair Photos", "sl_roomID", "ID", "Rooms");

            // Create Content Type "Property Photo" and Document Lib "Property Photos"
            CSOMUtil.CreateContentType(clientContext, "Property Photo", "", "0x0101006C010CC23D0643E3AADDC173CE461770", new string[] {
                "sl_propertyID"
            });
            CSOMUtil.AddSharePointList(clientContext, "0x0101006C010CC23D0643E3AADDC173CE461770", "Property Photos", "PropertyPhotos", (int)ListTemplateType.DocumentLibrary);
            CSOMUtil.BindLookupField(clientContext, "Property Photos", "sl_propertyID", "ID", "Properties");
        }