Git Product home page Git Product logo

Comments (13)

TobiG77 avatar TobiG77 commented on September 2, 2024

I've looked into this as well via extended_field_uri, http://msdn.microsoft.com/en-us/library/aa564843%28v=exchg.80%29.aspx

I got as far as dumping the soap response and it does not contain the requested information at all, I am currently looking at way to dump the SOAP request to confirm the SOAP request actually contains the extendedfielduri request.

  def get_custom_item(item_id, change_key = nil)
    item_shape = {:base_shape => 'AllProperties',
              :include_mime_content => TRUE,
              :additional_properties => {:extended_field_uRI => ['PropertySetId:0x8462001F',
                                                                 'PropertyName:ProjectCode',
                                                                 'PropertyType:String'],
                                         :value => TRUE}
             }
    resp = (Viewpoint::EWS::EWS.instance).ews.get_item([item_id], item_shape)

File.open('/tmp/soap_response.txt', 'w') {|f|f.write(resp.inspect)}
    if(resp.status == 'Success')
      item = resp.items.shift
      type = item.keys.first
      eval "#{type.to_s.camel_case}.new(item[type])"
    else
      raise EwsError, "Could not retrieve item. #{resp.code}: #{resp.message}"
    end
  end

from viewpoint.

TobiG77 avatar TobiG77 commented on September 2, 2024

right, been there before, but didn't connect the dots at the time

lib/soap/handsoap/builders/ews_build_helpers.rb filters out the provided arguments , this needs extending to support extendedfielduris

from viewpoint.

TobiG77 avatar TobiG77 commented on September 2, 2024

I've added this to into ews_build_helpers.rb

              unless( item_shape[:additional_properties][:extended_field_uri].nil? )
                is.add("#{NS_EWS_TYPES}:AdditionalProperties") do |addprops|
                  item_shape[:additional_properties][:extended_field_uri].each do |uri|
                    addprops.add("#{NS_EWS_TYPES}:ExtendedFieldURI") { |furi| furi.set_attr('ExtendedFieldURI', uri) }
                  end
                end
              end

Which gives me a request like below:

<m:GetItem xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
  <m:ItemShape>
    <t:BaseShape xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">AllProperties</t:BaseShape>
    <t:IncludeMimeContent xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">true</t:IncludeMimeContent>
    <t:AdditionalProperties xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
      <t:ExtendedFieldURI ExtendedFieldURI="PropertySetId:0x8462001F" />
      <t:ExtendedFieldURI ExtendedFieldURI="PropertyName:ProjectCode" />
      <t:ExtendedFieldURI ExtendedFieldURI="PropertyType=String" />
    </t:AdditionalProperties>
  </m:ItemShape>
</m:GetItem>

Haven't succeeded in passing the validation yet, either I'm cross eyed or the documentation is off

from viewpoint.

TobiG77 avatar TobiG77 commented on September 2, 2024

I found examples here: http://blogs.msdn.com/b/brijs/archive/2009/11/06/how-to-get-extended-mapi-properties-in-the-getitem-exchange-web-service-call.aspx & http://blogs.msdn.com/b/brijs/archive/2009/11/12/how-to-do-finditem-using-extended-mapi-properties-in-a-exchange-web-service-call.aspx

But I just can't pass validation ...

from viewpoint.

TobiG77 avatar TobiG77 commented on September 2, 2024

Unfortunately even on Exchange 2013 the environments aren't sufficiently feature par yet. So, we're looking at both using X-Headers for an RFC compliant approach and for the Outlook client, employing custom outlook properties to store additional meta-data. Via EWS we'd like to monitor and manage integrity of both sets of meta data and also retain them, while exporting.

So, is it feasible to support the ExtendedFieldUri function from EWS in viewpoint ?

from viewpoint.

zenchild avatar zenchild commented on September 2, 2024

This is pushed up to master and will be part of 1.0.0.beta.2. You can use it like so:

item = cli.get_item(i.id) do |obj|
  obj.opts[:item_shape][:additional_properties] = {
    field_uRI: [
      'item:ParentFolderId',
      'item:Categories',
      'item:ConversationId',
      'conversation:FlagStatus',
      'conversation:GlobalFlagStatus'
    ]
  }
end

If defined, you can access the parameters on the object otherwise you have to dig into item.ews_item.

cheers,

Dan

from viewpoint.

TobiG77 avatar TobiG77 commented on September 2, 2024

Thanks for the effort, great to see, will give master another shot!

from viewpoint.

TobiG77 avatar TobiG77 commented on September 2, 2024

Hi,

So, just upgraded to the master branch in a dev branch on our end and it's a big step up from 0.1 , kudos.

Now I've been playing with the retrieval of those pesky custom mapi properties

full_item = @cli.get_item(item_id) do |obj|
obj.opts[:item_shape][:additional_properties] = {
extended_field_uRI: {:distinguished_property_set_id => 'PublicStrings',
:distinguished_property_set_id_specified => TRUE,
:property_name => 'Job Number',
:property_type => 'String'
}
}

I've added the line
nbuild.parent['DistinguishedPropertySetIdSpecified'] = val[:distinguished_property_set_id_specified] if val[:distinguished_property_set_id_specified]

into the ews_builder.rb

to be able to use the distinguished_property_set_id , as per
http://msdn.microsoft.com/en-us/library/exchange/exchangewebservices.pathtoextendedfieldtype.distinguishedpropertysetid%28v=exchg.150%29.aspx

I've uploaded some output, github markdown got in the way , good also to see the soap request & response ! Makes debugging so much easier.

Now I can clearly see that I've set the DistinguishedPropertySetIdSpecified to true as per SOAP request, yet the request fails claiming it's not. Who here in the SOAP world does know why?

from viewpoint.

TobiG77 avatar TobiG77 commented on September 2, 2024

ews_invalid_schema

from viewpoint.

TobiG77 avatar TobiG77 commented on September 2, 2024

Must have been a red herring somewhere, rebuilding the request, like so:

obj.opts[:item_shape] = {:base_shape => 'AllProperties',
                         :additional_properties => {
                                                    extended_field_uRI: {:distinguished_property_set_id => 'PublicStrings',
                                                                         :property_name => 'Job Number',
                                                                         :property_type => 'String'
                                                                        }
                                                   }

<<< works, qed >>>

from viewpoint.

TobiG77 avatar TobiG77 commented on September 2, 2024

And a request for requesting a number of extended properties:

    @extended_message_item = @cli.get_item(args['item_id']['id']) do |obj|
      obj.opts[:item_shape] = {:base_shape => 'AllProperties',
                               :additional_properties => { extended_field_uRI: [{:distinguished_property_set_id => 'PublicStrings',
                                                                                 :property_name => 'Project',
                                                                                 :property_type => 'String'},
                                                                                {:distinguished_property_set_id => 'PublicStrings',
                                                                                 :property_name => 'Phase',
                                                                                 :property_type => 'String'
                                                                                },
                                                                                {:distinguished_property_set_id => 'PublicStrings',
                                                                                 :property_name => 'Org',
                                                                                 :property_type => 'String'
                                                                                }]}}
    end

from viewpoint.

nhu313 avatar nhu313 commented on September 2, 2024

I'm also trying to test out this feature. But I don't think I'm doing it right.

This is my original code (with start_date and end_date declared above)

      extended_field_URI = {:property_tag => '0x007D', :proptery_type => 'String'}
      additional_properties = {:base_shape => 'Default', :additional_properties => {:extended_field_uRI => extended_field_URI}}
      item_shape = {:item_shape => additional_properties}

      messages = @inbox.between(start_date, end_date, item_shape)

Obviously this was not right because the SOAP request was wrong. So I copied Tobias code to test it out.

messages = @inbox.items_between(start_date, end_date) do |obj|
      obj.opts[:item_shape] = {:base_shape => 'AllProperties',
                               :additional_properties => { extended_field_uRI: [{:distinguished_property_set_id => 'PublicStrings',
                                                                                 :property_name => 'Project',
                                                                                 :property_type => 'String'},
                                                                                {:distinguished_property_set_id => 'PublicStrings',
                                                                                 :property_name => 'Phase',
                                                                                 :property_type => 'String'
                                                                                },
                                                                                {:distinguished_property_set_id => 'PublicStrings',
                                                                                 :property_name => 'Org',
                                                                                 :property_type => 'String'
                                                                                }]}}
    end 

But I got

#<NoMethodError: undefined method `opts' for #<Viewpoint::EWS::Types::Message:0x007ffaf849f4a8>>

I left the properties as in just to test it out. The ItemShape is wrong. Did anyone get this to work?

from viewpoint.

TobiG77 avatar TobiG77 commented on September 2, 2024

Hi, I'll have a look later today to reproduce.

from viewpoint.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.