Ejemplo n.º 1
0
        public SharingLevelOfDetails(BaseFolderType folder)
        {
            this.currentLevel = LevelOfDetails.Unknown;
            CalendarFolderType calendarFolderType = folder as CalendarFolderType;

            if (calendarFolderType == null)
            {
                ContactsFolderType contactsFolderType = folder as ContactsFolderType;
                if (contactsFolderType != null)
                {
                    switch (contactsFolderType.SharingEffectiveRights)
                    {
                    case PermissionReadAccessType.None:
                        this.currentLevel = LevelOfDetails.None;
                        return;

                    case PermissionReadAccessType.FullDetails:
                        this.currentLevel = LevelOfDetails.Full;
                        break;

                    default:
                        return;
                    }
                }
                return;
            }
            switch (calendarFolderType.SharingEffectiveRights)
            {
            case CalendarPermissionReadAccessType.None:
                this.currentLevel = LevelOfDetails.None;
                return;

            case CalendarPermissionReadAccessType.TimeOnly:
                this.currentLevel = LevelOfDetails.Availability;
                return;

            case CalendarPermissionReadAccessType.TimeAndSubjectAndLocation:
                this.currentLevel = LevelOfDetails.Limited;
                return;

            case CalendarPermissionReadAccessType.FullDetails:
                this.currentLevel = LevelOfDetails.Full;
                return;

            default:
                return;
            }
        }
Ejemplo n.º 2
0
        public string GetCalendarFolder()
        {
            CalendarGroup[] array = new CalendarGroup[]
            {
                new CalendarGroup()
            };
            array[0].GroupId   = Guid.Empty.ToString();
            array[0].GroupType = CalendarGroupType.MyCalendars;
            array[0].GroupName = string.Empty;
            array[0].ItemId    = new Microsoft.Exchange.Services.Core.Types.ItemId(array[0].GroupId, array[0].GroupId);
            array[0].Calendars = new CalendarEntry[1];
            LocalCalendarEntry localCalendarEntry = new LocalCalendarEntry();

            localCalendarEntry.CalendarColor     = CalendarColor.Auto;
            localCalendarEntry.IsDefaultCalendar = true;
            array[0].Calendars[0] = localCalendarEntry;
            CalendarFolderType calendarFolderType = new CalendarFolderType();

            calendarFolderType.FolderId                                  = IdConverter.GetFolderIdFromStoreId(AnonymousUserContext.Current.PublishedCalendarId, new MailboxId(AnonymousUserContext.Current.ExchangePrincipal.MailboxInfo.MailboxGuid));
            localCalendarEntry.ItemId                                    = new Microsoft.Exchange.Services.Core.Types.ItemId("calendarEntryFor" + calendarFolderType.FolderId.Id, "calendarEntryChangeKeyFor" + calendarFolderType.FolderId.ChangeKey);
            calendarFolderType.DisplayName                               = AntiXssEncoder.HtmlEncode(AnonymousUserContext.Current.PublishedCalendarName, false);
            calendarFolderType.ChildFolderCount                          = new int?(0);
            calendarFolderType.ChildFolderCountSpecified                 = true;
            calendarFolderType.ExtendedProperty                          = null;
            calendarFolderType.FolderClass                               = "IPF.Appointment";
            calendarFolderType.EffectiveRights                           = new EffectiveRightsType();
            calendarFolderType.EffectiveRights.CreateAssociated          = false;
            calendarFolderType.EffectiveRights.CreateContents            = false;
            calendarFolderType.EffectiveRights.CreateHierarchy           = false;
            calendarFolderType.EffectiveRights.Delete                    = false;
            calendarFolderType.EffectiveRights.Modify                    = false;
            calendarFolderType.EffectiveRights.Read                      = true;
            calendarFolderType.EffectiveRights.ViewPrivateItemsSpecified = false;
            localCalendarEntry.CalendarFolderId                          = calendarFolderType.FolderId;
            GetCalendarFoldersResponse instance = new GetCalendarFoldersResponse(array, new CalendarFolderType[]
            {
                calendarFolderType
            });

            return(SessionDataHandler.EmitPayload("calendarFolders", JsonConverter.ToJSON(instance)));
        }
Ejemplo n.º 3
0
        public void MSOXWSFOLD_S04_TC01_GetCalendarFolder()
        {
            #region Get the Calendar folder.

            DistinguishedFolderIdType folder = new DistinguishedFolderIdType();
            folder.Id = (DistinguishedFolderIdNameType)DistinguishedFolderIdNameType.calendar;

            // GetFolder request.
            GetFolderType getCalendarFolderRequest = this.GetGetFolderRequest(DefaultShapeNamesType.IdOnly, folder);

            // Set to get additional property : folder class
            getCalendarFolderRequest.FolderShape.AdditionalProperties = new BasePathToElementType[]
            {
                new PathToUnindexedFieldType()
                {
                    FieldURI = UnindexedFieldURIType.folderFolderClass
                },
                new PathToUnindexedFieldType()
                {
                    FieldURI = UnindexedFieldURIType.folderEffectiveRights
                }
            };

            // Get the Calendar folder.
            GetFolderResponseType getCalendarFolderResponse = this.FOLDAdapter.GetFolder(getCalendarFolderRequest);

            // Check the response.
            Common.CheckOperationSuccess(getCalendarFolderResponse, 1, this.Site);

            // Variable to save the folder.
            FolderInfoResponseMessageType foldersResponseInfo = (FolderInfoResponseMessageType)getCalendarFolderResponse.ResponseMessages.Items[0];

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R29");

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R29
            this.Site.CaptureRequirementIfIsInstanceOfType(
                foldersResponseInfo.Folders[0],
                typeof(CalendarFolderType),
                29,
                @"[In t:ArrayOfFoldersType Complex Type]The type of element CalendarFolder is t:CalendarFolderType ([MS-OXWSMTGS] section 2.2.4.5).");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R2901");

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R2901
            this.Site.CaptureRequirementIfIsInstanceOfType(
                foldersResponseInfo.Folders[0],
                typeof(CalendarFolderType),
                2901,
                @"[In t:ArrayOfFoldersType Complex Type]CalendarFolder represents a Calendar folder in a mailbox.");

            CalendarFolderType folderInfo = (CalendarFolderType)foldersResponseInfo.Folders[0];

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R81");

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R81
            // Since the schema has been validate and this element is not null, this requirement will be captured.
            this.Site.CaptureRequirementIfIsNotNull(
                folderInfo.EffectiveRights,
                81,
                @"[In t:BaseFolderType Complex Type]The type of element EffectiveRights is t:EffectiveRightsType ([MS-OXWSCDATA] section 2.2.4.29).");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R5934");

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R5934
            // Effective rights is returned in response and schema is verified in adapter so this requirement can be captured.
            this.Site.CaptureRequirementIfIsNotNull(
                folderInfo.EffectiveRights,
                5934,
                @"[In t:BaseFolderType Complex Type]This property[EffectiveRights] is returned in a response.");

            // Add the debug information.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R70.");

            // Verify MS-OXWSFOLD_R70.
            Site.CaptureRequirementIfAreEqual <string>(
                "IPF.Appointment",
                folderInfo.FolderClass,
                70,
                @"[In t:BaseFolderType Complex Type]This value[FolderClass] MUST be ""IPF.Appointment"" for Calendar folders.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R42104");

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R42104
            // Additional property folder class is returned from server and schema is verified in adapter, so this requirement can be captured.
            this.Site.CaptureRequirementIfIsNotNull(
                folderInfo.FolderClass,
                42104,
                @"[In t:FolderResponseShapeType Complex Type]The element [AdditionalProperties] with type [t:NonEmptyArrayOfPathsToElementType] specifies the identity of additional properties to be returned in a response.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R42105");

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R42105
            // Additional property folder class is returned from server and schema is verified in adapter, so this requirement can be captured.
            this.Site.CaptureRequirementIfIsNotNull(
                folderInfo.FolderClass,
                42105,
                @"[In t:FolderResponseShapeType Complex Type][In t:NonEmptyArrayOfPathsToElementType Complex Type] The element [t:Path] with type [t:Path] specifies a property to be returned in a response.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R3864");

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R3864
            this.Site.CaptureRequirementIfAreEqual <ResponseClassType>(
                ResponseClassType.Success,
                getCalendarFolderResponse.ResponseMessages.Items[0].ResponseClass,
                3864,
                @"[In GetFolder Operation]A successful GetFolder operation request returns a GetFolderResponse element with the ResponseClass attribute of the GetFolderResponseMessage element set to ""Success"".");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R38644");

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R38644
            this.Site.CaptureRequirementIfAreEqual <ResponseCodeType>(
                ResponseCodeType.NoError,
                getCalendarFolderResponse.ResponseMessages.Items[0].ResponseCode,
                38644,
                @"[In GetFolder Operation]A successful GetFolder operation request returns a GetFolderResponse element with the ResponseCode element of the GetFolderResponse element set to ""NoError"".");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R575");

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R575
            // Folder information is returned from server and schema has verified in adapter, so this requirement can be covered.
            this.Site.CaptureRequirementIfIsNotNull(
                foldersResponseInfo,
                575,
                @"[In m:GetFolderType Complex Type]The GetFolderType complex type specifies a request message to get a folder in a server database.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R428");

            // GetFolder operation in this test case gets a distinguished folder : Calendar folder.
            this.Site.CaptureRequirement(
                428,
                @"[In t:NonEmptyArrayOfBaseFolderIdsType Complex Type]DistinguishedFolderId specifies a distinguished folder identifier.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R8402");

            // GetFolder operation in this test case gets a distinguished folder : Calendar folder.
            this.Site.CaptureRequirement(
                8402,
                @"[In t:BaseFolderType Complex Type]DistinguishedFolderId specifies an identifier for a folder that can be referenced by name.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R96");

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R96
            // Folder information is returned from server and schema has verified in adapter, so this requirement can be covered.
            this.Site.CaptureRequirementIfIsNotNull(
                foldersResponseInfo,
                96,
                @"[In m:FolderInfoResponseMessageType Complex Type]The type of element Folders is t:ArrayOfFoldersType (section 2.2.4.2).");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R9602");

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R9602
            // Folder information is returned from server and schema has verified in adapter, so this requirement can be covered.
            this.Site.CaptureRequirementIfIsNotNull(
                foldersResponseInfo,
                9602,
                @"[In m:FolderInfoResponseMessageType Complex Type][Folders] Represents the folders that are returned with the response message.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R8401");

            // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R8401
            // Distinguished folder id is set in request and schema is verified in adapter, so if folder information is returned successfully this can be covered.
            this.Site.CaptureRequirementIfAreEqual <ResponseClassType>(
                ResponseClassType.Success,
                getCalendarFolderResponse.ResponseMessages.Items[0].ResponseClass,
                8401,
                @"[In t:BaseFolderType Complex Type]The type of element DistinguishedFolderId is t:DistinguishedFolderIdNameType ([MS-OXWSCDATA] section 2.2.5.10).");

            #endregion
        }