Ejemplo n.º 1
0
		public void run()
		{
			IXConnFactory connFact = null;
			IXConnection ix = null;
			try 
			{
				IXProperties connProps = IXConnFactory.CreateConnProperties(url);
				IXProperties sessOpts = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0");
				connFact = new IXConnFactory(connProps, sessOpts);
				Logger.instance().log("create IXConnFactory OK");

				// Prepare ClientInfo object with language and country
				// ClientInfo ci = new ClientInfo();
				// ci.language = "de";
				// ci.country = "DE";

				// LOGIN
				Logger.instance().log("login...");
				ix = connFact.Create(userName, userPwd, "myComputer", null);
				// ci = ix.Login.ci
				Logger.instance().log("login OK");

				// get constants
				Logger.instance().log("get const...");
				IXServicePortC CONST = ix.CONST;
				Logger.instance().log("get const OK");

				// 1. Create archive structure
				Logger.instance().log("create structure...");

				// create root folder s1
				EditInfo ed = ix.Ix.createSord("1", "0", EditInfoC.mbAll);
				Sord s1 = ed.sord;
				s1.name = "s1 C# example FindByIndexValues";
				s1.id = ix.Ix.checkinSord(s1, SordC.mbAll, LockC.NO);

				//     name=ka-mo, mask=Email, [email protected], [email protected]
				//     name=ka-fi, mask=Email, [email protected], [email protected]
				//     name=mo-ka, mask=Email, [email protected], [email protected]
				//     name=mo-fi, mask=Email, [email protected], [email protected]
				//     name=fi-mo, mask=Email, [email protected], [email protected]
				//     name=fi-ka, mask=Email, [email protected], [email protected]
				//     name=ka-mofi, mask=Email, [email protected], [email protected],[email protected]
				Sord d1 = internalCreateEmail(ix, CONST, s1.guid, "ka-mo", karl, mona);
				Sord d2 = internalCreateEmail(ix, CONST, s1.guid, "ka-fi", karl, finn);
				Sord d3 = internalCreateEmail(ix, CONST, s1.guid, "mo-ka", mona, karl);
				Sord d4 = internalCreateEmail(ix, CONST, s1.guid, "mo-fi", mona, finn);
				Sord d5 = internalCreateEmail(ix, CONST, s1.guid, "fi-mo", finn, mona);
				Sord d6 = internalCreateEmail(ix, CONST, s1.guid, "fi-ka", finn, karl);
				Sord d7 = internalCreateEmail(ix, CONST, s1.guid, "ka-mofi", karl, mona + "," + finn);

				Logger.instance().log("create structure OK");

				// 2. Find emails sent from karl to mona: ka-mo, ka-mofi
				internalFindEmailsFromTo(ix, CONST, s1.guid, "*karl*", "*mona*");

				// 3. Find emails sent from karl to anyone: ka-mo, ka-fi, ka-mofi
				internalFindEmailsFromTo(ix, CONST, s1.guid, "*karl*", "*");

				// 4. Find emails sent from or to karl: ka-mo, ka-fi, mo-ka, fi-ka, ka-mofi
				internalFindEmailsFromTo(ix, CONST, s1.guid, "*karl*", "*karl*");

				// 5. Find emails sent from karl or from mona: ka-mo, ka-fi, mo-ka, mo-fi, ka-mofi
				internalFindEmailsFromTo(ix, CONST, s1.guid, "\"*karl*\" + \"*mona*\"", "*");

				// 6. Find emails sent to mona and finn: ka-mofi
				internalFindEmailsFromTo(ix, CONST, s1.guid, "*", "\"*mona*\" & \"*finn*\"");

				// 7. Find emails sent to mona or finn: ka-mo, ka-fi, mo-fi, fi-mo, ka-mofi
				internalFindEmailsFromTo(ix, CONST, s1.guid, "*", "\"*mona*\" + \"*finn*\"");

				bool cleanUp = true;
				if (cleanUp)
				{
					Logger.instance().log("clean up...");
          DeleteOptions delOpts = new DeleteOptions();
          delOpts.deleteFinally = true;
          ix.Ix.deleteSord(null, s1.guid, LockC.NO, delOpts);
					Logger.instance().log("clean up OK");
				}
			} 
			catch (Exception e) 
			{
				throw e;
			} 
			finally 
			{
				// Logout
				// --
				if (ix != null) 
				{
					Logger.instance().log("IX logout...");
					ix.Logout();
					Logger.instance().log("IX logout OK");
				}
			}

		}