Example #1
0
        public void Test_01_ListChildrenOf_ForWebSite( )
        {
            Proxy.NavigatorRef.Navigator nav = new Proxy.NavigatorRef.Navigator( );
            nav.Url = Globals.NavigatorUrl( );
            // Very important line - You must specify your credentials if the web service
            // is using trusted connections.
            nav.Credentials = System.Net.CredentialCache.DefaultCredentials.GetCredential( new Uri( Globals.SharePointTestServer ), "" );
            Proxy.NavigatorRef.Item[ ] items = nav.ListChildrenOf( Globals.SiteCollectionForTests( ) );
            Assert.IsTrue( items.Length != 0, "There must be SOMETHING there..." );
            Proxy.NavigatorRef.Item item1 = Helper_GetSpecificItem( items, "SubSite1" );
            Proxy.NavigatorRef.Item item2 = Helper_GetSpecificItem( items, "SubSite2" );
            Proxy.NavigatorRef.Item docLib1 = Helper_GetSpecificItem( items, "Custom Document Library" );
            Proxy.NavigatorRef.Item docLib2 = Helper_GetSpecificItem( items, "Shared Documents" );
            Assert.IsTrue( item1 != null && item2 != null, "An expected item was missing.  Has someone modified the TestingOnly Top Level Site?" );
            Assert.IsTrue( item1.Kind == Proxy.NavigatorRef.ItemKind.WebSite, "This item is supposed to be labelled a website." );
            Assert.IsTrue( item1.Url.ToLower( ) == ( Globals.SiteCollectionForTests( ) + "/subsite1" ).ToLower( ), "The Url for the subitem (1) is wrong!" );
            Assert.IsTrue( item2.Kind == Proxy.NavigatorRef.ItemKind.WebSite, "This item is supposed to be labelled a website." );
            Assert.IsTrue( item2.Url.ToLower( ) == ( Globals.SiteCollectionForTests( ) + "/subsite2" ).ToLower( ), "The Url for the subitem (2) is wrong!" );
            Assert.IsTrue( docLib1.Kind == Proxy.NavigatorRef.ItemKind.DocumentLibrary, "This item is supposed to be labelled a document library." );
            Assert.IsTrue( docLib1.Url.ToLower( ) == ( Globals.SiteCollectionForTests( ) + "/Custom Document Library" ).ToLower( ), "The Url for the document library (\"Custom\") is wrong!" );
            Assert.IsTrue( docLib2.Kind == Proxy.NavigatorRef.ItemKind.DocumentLibrary, "This item is supposed to be labelled a document library." );
            Assert.IsTrue( docLib2.Url.ToLower( ) == ( Globals.SiteCollectionForTests( ) + "/Shared Documents" ).ToLower( ), "The Url for the document library (\"Shared\") is wrong!" );

            items = nav.ListChildrenOf( item1.Url );
            Assert.IsTrue( items.Length != 0, "There must be SOMETHING there..." );
            item1 = Helper_GetSpecificItem( items, "Deeper1" );
            docLib1 = Helper_GetSpecificItem( items, "Shared Documents" );
            Assert.IsTrue( item1 != null, "This site DOES have a subsite called Deeper1!" );
            Assert.IsTrue( item1.Title == "Deeper1", "An expected item was WRONG!!  Has someone modified the TestingOnly/SubSite1 site?" );
            Assert.IsTrue( item1.Url.ToLower( ) == ( Globals.SiteCollectionForTests( ) + "/subsite1/deeper1" ).ToLower( ), "The Url for the sub-subitem is wrong!" );
            Assert.IsTrue( docLib1 != null, "This site DOES have a Shared Documents list." );
            Assert.IsTrue( docLib1.Title == "Shared Documents", "An expected item was WRONG!!  Has someone modified the TestingOnly/SubSite1/deeper1 site?" );
            Assert.IsTrue( docLib1.Url.ToLower( ) == ( Globals.SiteCollectionForTests( ) + "/subsite1/Shared Documents" ).ToLower( ), "The Url for the document library is wrong!" );
        }
        public AdvancedSearchDialog( string url, Proxy.NavigatorRef.Navigator navigator )
        {
            if( navigator == null || string.IsNullOrEmpty( url ) )
                throw new ArgumentException( );

            this.url = url;
            this.navigator = navigator;
            InitializeComponent( );
        }
Example #3
0
        private void button1_Click( object sender, EventArgs e )
        {
            try
            {
                Proxy.NavigatorRef.Navigator nav = new Proxy.NavigatorRef.Navigator( );
                nav.UseDefaultCredentials = true;

                this.listView1.Items.Clear( );

                Proxy.NavigatorRef.Item[ ] items = nav.GetItemsFromCAML( this.textBox1.Text, this.textBox2.Text, 100 );
                foreach( Proxy.NavigatorRef.Item item in items )
                {
                    this.listView1.Items.Add( new ListViewItem( item.Title ) );
                }
            }
            catch( Exception ex )
            {
                MessageBox.Show( ex.Message );
            }
        }
Example #4
0
        public void Test_02_ListChildrenOf_ForDocumentLibraray( )
        {
            Proxy.NavigatorRef.Navigator nav = new Proxy.NavigatorRef.Navigator( );
            nav.Url = Globals.NavigatorUrl( );
            nav.Credentials = System.Net.CredentialCache.DefaultCredentials.GetCredential( new Uri( Globals.SharePointTestServer ), "" );

            Proxy.NavigatorRef.Item[ ] items = nav.ListChildrenOf( Globals.DocumentLibForTests( ) );
            Assert.IsTrue( items.Length == 2, "There should only be two word documents in this Library" );
            Proxy.NavigatorRef.Item document1 = Helper_GetSpecificItem( items, "Expected Test Document 1.doc" );
            Proxy.NavigatorRef.Item document2 = Helper_GetSpecificItem( items, "Expected Test Document 2.doc" );

            Assert.IsTrue( document1 != null, "Failed to retrieve the first test document from the server." );
            Assert.IsTrue( document2 != null, "Failed to retrieve the second test document from the server." );

            Assert.IsTrue( document1.Kind == Proxy.NavigatorRef.ItemKind.File, "It's a file.  Trust me on this one!" );
            Assert.IsTrue( document2.Kind == Proxy.NavigatorRef.ItemKind.File, "It's also a file.  Trust me on this one!" );

            Assert.IsTrue( document1.Title.ToLower( ) == "expected test document 1.doc", "Failed to populate the item's title." );
            Assert.IsTrue( document2.Title.ToLower( ) == "expected test document 2.doc", "Failed to populate the other item's title." );

            Assert.IsTrue( document1.Url.ToLower( ) == ( Globals.DocumentLibForTests( ) + "/" + document1.Title ).ToLower( ), "Document 1 Url wrong." );
            Assert.IsTrue( document2.Url.ToLower( ) == ( Globals.DocumentLibForTests( ) + "/" + document2.Title ).ToLower( ), "Document 2 Url wrong." );
        }
Example #5
0
        public void Test_03_ListChildrenOf_ForDocumentLibraryWithSubFolder( )
        {
            Proxy.NavigatorRef.Navigator nav = new Proxy.NavigatorRef.Navigator( );
            nav.Url = Globals.NavigatorUrl( );
            nav.Credentials = System.Net.CredentialCache.DefaultCredentials.GetCredential( new Uri( Globals.SharePointTestServer ), "" );

            Proxy.NavigatorRef.Item[ ] items = nav.ListChildrenOf( Globals.DocumentLibForTestsWithSubFolders( ) );

            Assert.IsTrue( items.Length == 2, "There should only be two word documents in this Library" );
            Proxy.NavigatorRef.Item document1 = Helper_GetSpecificItem( items, "Please please leave this file here.doc" );
            Proxy.NavigatorRef.Item folder1 = Helper_GetSpecificItem( items, "SubFolderLevel1" );

            Assert.IsTrue( document1 != null, "Failed to retrieve the first test document from the server." );
            Assert.IsTrue( folder1 != null, "Failed to retrieve the folder from the server." );

            Assert.IsTrue( document1.Kind == Proxy.NavigatorRef.ItemKind.File, "It's a file.  Trust me on this one!" );
            Assert.IsTrue( folder1.Kind == Proxy.NavigatorRef.ItemKind.Folder, "It's a folder.  Trust me on this one!" );

            Assert.IsTrue( document1.Title == "Please please leave this file here.doc", "Um, there is something wrong with title." );
            Assert.IsTrue( folder1.Title == "SubFolderLevel1", "Um, there is something wrong with title." );

            Assert.IsTrue( document1.Url.ToLower( ) == ( Globals.DocumentLibForTestsWithSubFolders( ) + "/" + document1.Title ).ToLower( ), "The Url for the file is wrong." );
            Assert.IsTrue( folder1.Url.ToLower( ) == ( Globals.DocumentLibForTestsWithSubFolders( ) + "/" + folder1.Title ).ToLower( ), "The Url for the folder is wrong." );
        }
Example #6
0
 public AdvancedSearchRow( Proxy.NavigatorRef.Navigator navigator, string url )
 {
     this.url = url;
     this.navigator = navigator;
     InitializeComponent( );
 }
Example #7
0
        public void Test_07_TestHandshake( )
        {
            Proxy.NavigatorRef.Navigator nav = new Proxy.NavigatorRef.Navigator( );
            nav.Url = Globals.NavigatorUrl( );
            nav.Credentials = System.Net.CredentialCache.DefaultCredentials.GetCredential( new Uri( Globals.SharePointTestServer ), "" );

            string reply = nav.Handshake( );
            Assert.IsTrue( reply == "Hello", "This handshake is used to trigger an attempt to re-authenticate on NT domains." );
        }
Example #8
0
        public void Test_06_GetItem( )
        {
            Proxy.NavigatorRef.Navigator nav = new Proxy.NavigatorRef.Navigator( );
            nav.Url = Globals.NavigatorUrl( );
            nav.Credentials = System.Net.CredentialCache.DefaultCredentials.GetCredential( new Uri( Globals.SharePointTestServer ), "" );

            Proxy.NavigatorRef.Item topLevelSite = nav.GetItem( Globals.SiteCollectionForTests( ) );
            Proxy.NavigatorRef.Item docLib = nav.GetItem( Globals.DocumentLibForTests( ) );
            Proxy.NavigatorRef.Item folder = nav.GetItem( Globals.DeepFolderForTests( ) );
            string veryDeepDocument = Globals.DocumentLibForTestsWithSubFolders( ) + "/SubFolderLevel1/Even deeper/Deep Document.doc";
            Proxy.NavigatorRef.Item file = nav.GetItem( veryDeepDocument );

            Assert.IsTrue( topLevelSite.Url.ToLower( ) == Globals.SiteCollectionForTests( ).ToLower( ), "The Top-Level-Site is the parent." );
            Assert.IsTrue( topLevelSite.Title == "TestingOnly", "Problem getting the title here." );
            Assert.IsTrue( topLevelSite.Kind == Proxy.NavigatorRef.ItemKind.WebSite, "Problem getting the kind here." );
            Assert.IsTrue( docLib.Url.ToLower( ) == Globals.DocumentLibForTests( ).ToLower( ), "This document library should exist." );
            Assert.IsTrue( docLib.Title == "Shared Documents", "Problem getting the title here." );
            Assert.IsTrue( docLib.Kind == Proxy.NavigatorRef.ItemKind.DocumentLibrary, "Problem getting the kind here." );
            Assert.IsTrue( folder.Url.ToLower( ) == Globals.DeepFolderForTests( ).ToLower( ), "Ok, where is the deep folder?  Who hid it?!" );
            Assert.IsTrue( folder.Title == "SubFolderLevel1", "Problem getting the title here." );
            Assert.IsTrue( folder.Kind == Proxy.NavigatorRef.ItemKind.Folder, "Problem getting the kind here." );
            Assert.IsTrue( file.Url.ToLower( ) == veryDeepDocument.ToLower( ), "Ok, where is the deep document?  Who hid it?!" );
            Assert.IsTrue( file.Title.ToLower( ) == "deep document.doc", "Problem getting the title here." );
            Assert.IsTrue( file.Kind == Proxy.NavigatorRef.ItemKind.File, "Problem getting the kind here." );
            Assert.IsTrue( file.Guid.Length == 0, "Files don't have GUIDs." );

        }
Example #9
0
        public void Test_05_GetParentOf( )
        {
            Proxy.NavigatorRef.Navigator nav = new Proxy.NavigatorRef.Navigator( );
            nav.Url = Globals.NavigatorUrl( );
            nav.Credentials = System.Net.CredentialCache.DefaultCredentials.GetCredential( new Uri( Globals.SharePointTestServer ), "" );

            Proxy.NavigatorRef.Item parentOfRoot = nav.GetParentOf( Globals.SiteCollectionForTests( ) );
            Proxy.NavigatorRef.Item docLibParent = nav.GetParentOf( Globals.DocumentLibForTests( ) );
            Proxy.NavigatorRef.Item folderParent = nav.GetParentOf( Globals.DeepFolderForTests( ) );

            Assert.IsTrue( parentOfRoot != null );
            Assert.IsTrue( parentOfRoot.Kind == Workshare.Connect.SharePoint.Proxy.NavigatorRef.ItemKind.WebSite );
            Assert.IsTrue( parentOfRoot.Title == "UnitTests" );
            Assert.IsTrue( docLibParent.Url.ToLower( ) == Globals.SharePointTestServer.ToLower( ) + "/sites/dev/unittests/testingonly", "The Top-Level-Site is the parent." );
            Assert.IsTrue( docLibParent.Title == "TestingOnly", "Problem getting the title here." );
            Assert.IsTrue( docLibParent.Kind == Proxy.NavigatorRef.ItemKind.WebSite, "Problem getting the kind here." );
            Assert.IsTrue( folderParent.Url.ToLower( ) == Globals.SharePointTestServer.ToLower( ) + "/sites/dev/unittests/testingonly/custom document library", "There is no parent, there should be." );
            Assert.IsTrue( folderParent.Title == "Custom Document Library", "Problem getting the title here." );
            Assert.IsTrue( folderParent.Kind == Proxy.NavigatorRef.ItemKind.DocumentLibrary, "Problem getting the kind here." );
        }
Example #10
0
 public ViewCamlForm( )
 {
     InitializeComponent( );
     this.navigator = new Proxy.NavigatorRef.Navigator( );
     this.navigator.UseDefaultCredentials = true;
 }
Example #11
0
		private bool Helper_FolderExists(string url)
		{
            Proxy.NavigatorRef.Navigator nav = new Proxy.NavigatorRef.Navigator( );
			nav.Url = Globals.NavigatorUrl();
			nav.Credentials = System.Net.CredentialCache.DefaultCredentials.GetCredential(new Uri(Globals.SharePointTestServer), "");

            Proxy.NavigatorRef.Item item = nav.GetItem( url );
            return ( item != null && item.Kind == Proxy.NavigatorRef.ItemKind.Folder );
		}