Click here to Skip to main content
15,887,979 members
Home / Discussions / C#
   

C#

 
GeneralRe: Problem with wmi and exchange Pin
turbosupramk330-May-12 3:39
turbosupramk330-May-12 3:39 
GeneralRe: Problem with wmi and exchange Pin
Dave Kreskowiak30-May-12 4:22
mveDave Kreskowiak30-May-12 4:22 
GeneralRe: Problem with wmi and exchange Pin
turbosupramk330-May-12 4:32
turbosupramk330-May-12 4:32 
GeneralRe: Problem with wmi and exchange Pin
Dave Kreskowiak30-May-12 5:19
mveDave Kreskowiak30-May-12 5:19 
GeneralRe: Problem with wmi and exchange Pin
turbosupramk330-May-12 5:38
turbosupramk330-May-12 5:38 
GeneralRe: Problem with wmi and exchange Pin
Dave Kreskowiak30-May-12 7:05
mveDave Kreskowiak30-May-12 7:05 
GeneralRe: Problem with wmi and exchange Pin
turbosupramk330-May-12 7:40
turbosupramk330-May-12 7:40 
GeneralRe: Problem with wmi and exchange Pin
turbosupramk330-May-12 9:28
turbosupramk330-May-12 9:28 
Update:

I'm able to get it working, but only for my own mailbox? Any ideas? I can get it to attempt other users, but I get a permissions error. I'm an exchange org admin and full admin so I'm not sure why that would be?


C#
 private static readonly ExtendedPropertyDefinition PidTagMessageSizeExtended
                        = new ExtendedPropertyDefinition(0xe08, MapiPropertyType.Long);

private void button1_Click(object sender, EventArgs e) // test
        {

            ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);

        
            //Change the Credentials to suit you needs
            service.Credentials = new WebCredentials("[account]", "[password]", "[domain]");
            

            //Use Autodiscover or Set the URL manually. Change the email address to match yours
            service.AutodiscoverUrl("emailaddress@domain.com");
            
            int moffset = 0;
            int mPageSize = 500;
            FolderView view = new FolderView(mPageSize, moffset, OffsetBasePoint.Beginning);

            // Identify the properties to return in the results set.
            view.PropertySet = new PropertySet(BasePropertySet.IdOnly);
            view.PropertySet.Add(FolderSchema.DisplayName);
            view.PropertySet.Add(FolderSchema.ChildFolderCount);
            view.PropertySet.Add(FolderSchema.TotalCount);
            view.PropertySet.Add(FolderSchema.UnreadCount);
            
            // Unlike FindItem searches, folder searches can be deep traversals.
            view.Traversal = FolderTraversal.Deep;//.Shallow;
            //FindFoldersResults folders = service.FindFolders(WellKnownFolderName.MsgFolderRoot, view);
            FindFoldersResults folders = service.FindFolders(WellKnownFolderName.MsgFolderRoot, view);


            var offset = 0;
            const int pagesize = 500;
            long size = 0;

            FindFoldersResults foldersNew;
            do
            {
                foldersNew = service.FindFolders(WellKnownFolderName.MsgFolderRoot,
                                              new FolderView(pagesize, offset, OffsetBasePoint.Beginning)
                                              {
                                                  Traversal = FolderTraversal.Deep,
                                                  PropertySet =
                                                      new PropertySet(BasePropertySet.IdOnly, PidTagMessageSizeExtended,
                                                                      FolderSchema.DisplayName)
                                              });
                foreach (var folderNew in foldersNew)
                {
                    object folderSize;
                    if (folderNew.TryGetProperty(PidTagMessageSizeExtended, out folderSize))
                    {
                        //Console.Out.WriteLine("{0}: {1:00.00} MB", folderNew.DisplayName, folderSize / 1048576);
                        int bytes = Convert.ToInt32(folderSize);
                        int megaBytes = (bytes / 1048576);
                        size += megaBytes;
                        MessageBox.Show(folderNew.DisplayName + ": " + megaBytes + ", total mailbox size: " + size);
                    }
                }
                offset += pagesize;
            } while (folders.MoreAvailable); 
}


modified 30-May-12 16:54pm.

GeneralRe: Problem with wmi and exchange Pin
turbosupramk330-May-12 11:51
turbosupramk330-May-12 11:51 
GeneralRe: Problem with wmi and exchange Pin
Dave Kreskowiak30-May-12 15:28
mveDave Kreskowiak30-May-12 15:28 
Questionvalidation summary is showing before the submit button click Pin
Dhyanga29-May-12 9:47
Dhyanga29-May-12 9:47 
AnswerRe: validation summary is showing before the submit button click Pin
enhzflep30-May-12 6:53
enhzflep30-May-12 6:53 
QuestionHow do you add a second icon to a gui toolbar? Pin
turbosupramk329-May-12 4:43
turbosupramk329-May-12 4:43 
AnswerRe: How do you add a second icon to a gui toolbar? Pin
Ravi Bhavnani29-May-12 5:53
professionalRavi Bhavnani29-May-12 5:53 
GeneralRe: How do you add a second icon to a gui toolbar? Pin
turbosupramk329-May-12 9:34
turbosupramk329-May-12 9:34 
GeneralRe: How do you add a second icon to a gui toolbar? Pin
bishnoiparmod29-May-12 21:00
bishnoiparmod29-May-12 21:00 
AnswerRe: How do you add a second icon to a gui toolbar? Pin
Eddy Vluggen29-May-12 8:57
professionalEddy Vluggen29-May-12 8:57 
GeneralRe: How do you add a second icon to a gui toolbar? Pin
turbosupramk329-May-12 9:34
turbosupramk329-May-12 9:34 
GeneralRe: How do you add a second icon to a gui toolbar? Pin
Eddy Vluggen29-May-12 9:50
professionalEddy Vluggen29-May-12 9:50 
AnswerRe: How do you add a second icon to a gui toolbar? Pin
BobJanova29-May-12 23:09
BobJanova29-May-12 23:09 
QuestionChange password in System.Data.Sqlite Pin
amrok2amrokk29-May-12 2:49
amrok2amrokk29-May-12 2:49 
AnswerRe: Change password in System.Data.Sqlite Pin
Pete O'Hanlon29-May-12 3:14
mvePete O'Hanlon29-May-12 3:14 
GeneralRe: Change password in System.Data.Sqlite Pin
amrok2amrokk29-May-12 3:32
amrok2amrokk29-May-12 3:32 
GeneralRe: Change password in System.Data.Sqlite Pin
amrok2amrokk29-May-12 4:46
amrok2amrokk29-May-12 4:46 
GeneralRe: Change password in System.Data.Sqlite Pin
amrok2amrokk29-May-12 7:04
amrok2amrokk29-May-12 7:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.