This example shows how to retrieve lazy properties. The assigned schedule properties for advertisements are lazy. Therefore, when querying advertisements, each advertisement instance must be retrieved separately and the assigned schedule properties must be parsed separately.
For more information on lazy properties, see SMS Objects.
To read a lazy property
-
Connect to an SMS Provider, and get the SWbemServices object.
-
Get a collection of all advertisements:
Set colAdvertisements = objSWbemServices.ExecQuery("Select * From SMS_Advertisement") -
Iterate through the advertisement collection and display the lazy properties:
For Each objAdvert In colAdvertisements WScript.Echo "ActionInProgress = " & objAdvert.ActionInProgress WScript.Echo "AdvertFlags = " & objAdvert.AdvertFlags WScript.Echo "AdvertisementID = " & objAdvert.AdvertisementID WScript.Echo "AdvertisementName = " & objAdvert.AdvertisementName 'For the lazy properties, get the advertisements individually. Set lazyproperties = objSWbemServices.Get("SMS_Advertisement.AdvertisementID='" & ObjAdvert.advertisementid & "'") WScript.Echo "Assigned Schedule = {" for i=0 to ubound(lazyproperties.assignedschedule,1) WScript.Echo " instance of " & lazyproperties.Properties_("AssignedSchedule").Value(0).Path_.Class WScript.Echo lazyproperties.Properties_("AssignedSchedule").Qualifiers_("CIMType") WScript.Echo " DayDuration: " & lazyproperties.AssignedSchedule(i).DayDuration WScript.Echo " Hourspan: " & lazyproperties.AssignedSchedule(i).HourSpan WScript.Echo " IsGMT: " & lazyproperties.AssignedSchedule(i).IsGMT WScript.Echo " StartTime: " & lazyproperties.AssignedSchedule(i).StartTime WScript.Echo "AssignedScheduleEnabled = " & lazyproperties.AssignedScheduleEnabled WScript.Echo "AssignedScheduleIsGMT = " & lazyproperties.AssignedScheduleIsGMT next WScript.Echo "}" WScript.Echo "CollectionID = " & objAdvert.CollectionID WScript.Echo "Comment = " & objAdvert.CommentNext
本文介绍了一种从SMS广告中获取懒加载属性的方法。通过连接SMS提供程序并执行查询来获取所有广告实例,然后单独解析每个实例的懒加载属性。示例展示了如何读取这些属性,包括广告进度、标志、ID及名称等。
9927

被折叠的 条评论
为什么被折叠?



