![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Type formatting question on properties that are collections OK I'm trying to figure out it is that some collections get expanded and some don't. I have a Send-SmtpMail cmdlet that spits out the MailMessage object and that it sends and the output needs a little work: 5> gps w* | Send-SmtpMail -to john@doe.com,jane@doe.com -Subject "Test" -Body "Hi" -AttachmentPath \temp\foo.* -whatif What if: Performing operation "Send-SmtpMail" on Target "System.Net.Mail.MailMessage". From : rkeithhill@dev.null.com ReplyTo : To : {, } CC : {} Bcc : {} Attachments : {foo.bar, foo.bat, foo.bli, foo.config, foo.cs, foo.dll, foo.ksh, foo.msh, foo.ps1, foo.reg, foo.sln, foo .txt, foo.xml} Priority : Normal Subject : Test IsBodyHtml : False Body : Hi Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName ------- ------ ----- ----- ----- ------ -- ----------- 756 209 5788 2128 137 20.00 668 wcescomm 139 5 3420 1484 45 5.06 4372 WCESMgr 225 6 1720 6268 51 24.06 204 WeatherDataClient 237 6 6712 2336 78 46.30 3124 WindowsSearch 690 69 13560 3376 78 89.30 1756 winlogon 672 16 14560 23764 107 58.27 2512 winss 192 6 6712 2020 54 31.11 1640 winssnotify 148 3 1884 5076 37 13.86 1100 wmiprvse 505 21 82364 79656 177 44.75 7884 wmplayer Now why does the Attachments collection (AttachmentsCollection) contents get displayed but the To collection (MailAddressCollection) contents don't get displayed? -- Keith |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: Type formatting question on properties that are collections Do the following: 5> $x = gps w* | Send-SmtpMail -to john@doe.com,jane@doe.com -Subject "Test" -Body "Hi" -AttachmentPath \temp\foo.* -whatif What if: Performing operation "Send-SmtpMail" on Target "System.Net.Mail.MailMessage". 6> $x.To |Format-list * 7> $x | %{"$_"} And send the results. -- Jeffrey Snover [MSFT] Windows PowerShell Architect Microsoft Corporation This posting is provided "AS IS" with no warranties, no confers rights. |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: Type formatting question on properties that are collections Here ya go: 2> $x.To | Format-List * DisplayName : User : john Host : doe.com Address : john@doe.com DisplayName : User : jane Host : doe.com Address : jane@doe.com 3> $x | %{"$_"} System.Net.Mail.MailMessage 4> $x From : rkeithhill@comcast.net ReplyTo : To : {, } CC : {} Bcc : {} Attachments : {foo.bar, foo.bat, foo.bli, foo.config, foo.cs, foo.dll, .txt, foo.xml} Priority : Normal Subject : Test IsBodyHtml : False Body : Hi Hmm, perhaps the MailAddress object is using the DipslayName as its representation? How do I override that behavior for the display of a collection of those objects? -- Keith "Jeffrey Snover [MSFT]" <jsnover@ntdev.microsoft.com> wrote in message news:BCCFD5C4-8FDC-4F4E-A5D2-2B9113B07BA4@microsoft.com... Do the following: 5> $x = gps w* | Send-SmtpMail -to john@doe.com,jane@doe.com -Subject "Test" -Body "Hi" -AttachmentPath \temp\foo.* -whatif What if: Performing operation "Send-SmtpMail" on Target "System.Net.Mail.MailMessage". 6> $x.To |Format-list * 7> $x | %{"$_"} And send the results. -- Jeffrey Snover [MSFT] Windows PowerShell Architect Microsoft Corporation This posting is provided "AS IS" with no warranties, no confers rights. |
My System Specs![]() |
| | #4 (permalink) |
| Guest | Re: Type formatting question on properties that are collections Sorry. Actually I meant to ask for 5> $x.To | %{"$_"} (I'm thinking that they might have a broken ToString(). If you look at the $X , it actually is printing out a list of 2 items but each item appears to be a null string. To : {, } jps "Keith Hill [MVP]" <r_keith_hill@mailhot.moc.nospam> wrote in message news:OWaU3nQLHHA.4376@TK2MSFTNGP03.phx.gbl... Here ya go: 2> $x.To | Format-List * DisplayName : User : john Host : doe.com Address : john@doe.com DisplayName : User : jane Host : doe.com Address : jane@doe.com 3> $x | %{"$_"} System.Net.Mail.MailMessage 4> $x From : rkeithhill@comcast.net ReplyTo : To : {, } CC : {} Bcc : {} Attachments : {foo.bar, foo.bat, foo.bli, foo.config, foo.cs, foo.dll, .txt, foo.xml} Priority : Normal Subject : Test IsBodyHtml : False Body : Hi Hmm, perhaps the MailAddress object is using the DipslayName as its representation? How do I override that behavior for the display of a collection of those objects? -- Keith "Jeffrey Snover [MSFT]" <jsnover@ntdev.microsoft.com> wrote in message news:BCCFD5C4-8FDC-4F4E-A5D2-2B9113B07BA4@microsoft.com... Do the following: 5> $x = gps w* | Send-SmtpMail -to john@doe.com,jane@doe.com -Subject "Test" -Body "Hi" -AttachmentPath \temp\foo.* -whatif What if: Performing operation "Send-SmtpMail" on Target "System.Net.Mail.MailMessage". 6> $x.To |Format-list * 7> $x | %{"$_"} And send the results. -- Jeffrey Snover [MSFT] Windows PowerShell Architect Microsoft Corporation This posting is provided "AS IS" with no warranties, no confers rights. -- Jeffrey Snover [MSFT] Windows PowerShell Architect Microsoft Corporation This posting is provided "AS IS" with no warranties, no confers rights. |
My System Specs![]() |
| | #5 (permalink) |
| Guest | Re: Type formatting question on properties that are collections 5> $x.To | %{"$_"} john@doe.com jane@doe.com 6> $x.To | %{$_.ToString()} john@doe.com jane@doe.com 7> ,$x.To | %{$_.ToString()} john@doe.com, jane@doe.com Hmm.. BTW I do have a custom formatter for MailMesage which is the object that contains the MailAddressCollection but I haven't defined anything for MailAddress. Here's the MailMessage view which is just hiding extraneous properties: <View> <Name>System.Net.Mail.MailMessage</Name> <ViewSelectedBy> <TypeName>System.Net.Mail.MailMessage</TypeName> </ViewSelectedBy> <ListControl> <ListEntries> <ListEntry> <ListItems> <ListItem> <PropertyName>From</PropertyName> </ListItem> <ListItem> <PropertyName>ReplyTo</PropertyName> </ListItem> <ListItem> <PropertyName>To</PropertyName> </ListItem> <ListItem> <PropertyName>CC</PropertyName> </ListItem> <ListItem> <PropertyName>Bcc</PropertyName> </ListItem> <ListItem> <PropertyName>Attachments</PropertyName> </ListItem> <ListItem> <PropertyName>Priority</PropertyName> </ListItem> <ListItem> <PropertyName>Subject</PropertyName> </ListItem> <ListItem> <PropertyName>IsBodyHtml</PropertyName> </ListItem> <ListItem> <PropertyName>Body</PropertyName> </ListItem> </ListItems> </ListEntry> </ListEntries> </ListControl> </View> BTW I still don't see the To entries when I remove this view definition so I don't think this view definition is causing the problem. -- Keith "Jeffrey Snover [MSFT]" <jsnover@ntdev.microsoft.com> wrote in message news:21BE4B87-95AC-4238-A1F1-D09CFBA7C6C3@microsoft.com... Sorry. Actually I meant to ask for 5> $x.To | %{"$_"} (I'm thinking that they might have a broken ToString(). If you look at the $X , it actually is printing out a list of 2 items but each item appears to be a null string. To : {, } jps |
My System Specs![]() |
| | #6 (permalink) |
| Guest | Re: Type formatting question on properties that are collections F.Y.I., same happens on a dataSet ( I noticed on my new Tabcompletion script) PoSH>$dsTabExpansion RemotingFormat : Xml SchemaSerializationMode : IncludeSchema CaseSensitive : False DefaultViewManager : {System.Data.DataViewManagerListItemTypeDescriptor} EnforceConstraints : True DataSetName : TabExpansion Namespace : Prefix : ExtendedProperties : {} HasErrors : False IsInitialized : True Locale : en-US Site : Relations : {} Tables : {, , } Container : DesignMode : False PoSH>$dsTabExpansion.tables |% {$_.tablename} Custom Types Wmi gr /\/\o\/\/ http://ThePowerShellGuy.com "Keith Hill [MVP]" <r_keith_hill@mailhot.moc.nospam> wrote in message news:e9C0NTRLHHA.1252@TK2MSFTNGP02.phx.gbl... 5> $x.To | %{"$_"} john@doe.com jane@doe.com 6> $x.To | %{$_.ToString()} john@doe.com jane@doe.com 7> ,$x.To | %{$_.ToString()} john@doe.com, jane@doe.com Hmm.. BTW I do have a custom formatter for MailMesage which is the object that contains the MailAddressCollection but I haven't defined anything for MailAddress. Here's the MailMessage view which is just hiding extraneous properties: <View> <Name>System.Net.Mail.MailMessage</Name> <ViewSelectedBy> <TypeName>System.Net.Mail.MailMessage</TypeName> </ViewSelectedBy> <ListControl> <ListEntries> <ListEntry> <ListItems> <ListItem> <PropertyName>From</PropertyName> </ListItem> <ListItem> <PropertyName>ReplyTo</PropertyName> </ListItem> <ListItem> <PropertyName>To</PropertyName> </ListItem> <ListItem> <PropertyName>CC</PropertyName> </ListItem> <ListItem> <PropertyName>Bcc</PropertyName> </ListItem> <ListItem> <PropertyName>Attachments</PropertyName> </ListItem> <ListItem> <PropertyName>Priority</PropertyName> </ListItem> <ListItem> <PropertyName>Subject</PropertyName> </ListItem> <ListItem> <PropertyName>IsBodyHtml</PropertyName> </ListItem> <ListItem> <PropertyName>Body</PropertyName> </ListItem> </ListItems> </ListEntry> </ListEntries> </ListControl> </View> BTW I still don't see the To entries when I remove this view definition so I don't think this view definition is causing the problem. -- Keith "Jeffrey Snover [MSFT]" <jsnover@ntdev.microsoft.com> wrote in message news:21BE4B87-95AC-4238-A1F1-D09CFBA7C6C3@microsoft.com... Sorry. Actually I meant to ask for 5> $x.To | %{"$_"} (I'm thinking that they might have a broken ToString(). If you look at the $X , it actually is printing out a list of 2 items but each item appears to be a null string. To : {, } jps |
My System Specs![]() |
| | #7 (permalink) |
| Guest | Re: Type formatting question on properties that are collections Sounds like it is time to file a bug. -- Jeffrey Snover [MSFT] Windows PowerShell Architect Microsoft Corporation This posting is provided "AS IS" with no warranties, no confers rights. |
My System Specs![]() |
| | #8 (permalink) |
| Guest | Re: Type formatting question on properties that are collections Done: https://connect.microsoft.com/feedba...9112&SiteID=99 -- Keith "Jeffrey Snover [MSFT]" <jsnover@ntdev.microsoft.com> wrote in message news:2DBC7556-E213-4E3E-AFC0-E0F4F151C10E@microsoft.com... Sounds like it is time to file a bug. |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Cant type question marks or slashes | *Carla* | Live Messenger | 1 | 02-06-2008 11:53 AM |
| Installing Vista on a RAID drive -- question regarding formatting | Daervon | Vista General | 1 | 03-05-2007 12:50 PM |
| Installing on a RAID drive -- question about formatting | Daervon | Vista installation & setup | 1 | 03-05-2007 12:05 PM |
| Clear Type tuner question... | Alex | Vista General | 5 | 02-02-2007 12:02 PM |
| Confused getting properties of Collections of one vs. many | =?Utf-8?B?TWlrZSBCcmlkZ2U=?= bridgecanada _ com> | PowerShell | 19 | 09-04-2006 11:26 AM |