Hi,

I have an ActiveSync service provider that needs to do only one way
sync (so its essentially a transfer), i.e., it needs to move a bunch
of files from the desktop to the device. The device side provider
implementation therefore is pretty minimal except for the
"IReplObjHandler" implementation. In fact, from "ObjectNotify" I just
return FALSE.

Now here's the issue - everytime I sync and uncradle the device all
the items I have just synced fall off ActiveSync's radar so to speak,
so that during the next sync ActiveSync does not really remember the
stuff that was synced during the previous session. This happens only
if I uncradle before I sync the second time. If I keep it connected
then it works just fine.

The reason why this happens appears to be that after cradling the
device during the second sync, ActiveSync seems to do a device-to-
desktop sync first, as a result of which "DeleteObj" gets called on
the desktop side for every single item that was synced during the
first sync. My implementation of "DeleteObj" on the desktop side does
nothing other than return S_OK. Naturally, this results in all those
items being removed from wherever it is that ActiveSync keeps that
list (repl.dat?). Just to clarify, here's the scenario which causes
the problem:

[1] Cradle device
[2] Synchronize - let's say 5 items get
transferred to the device
[4] Uncradle device
[5] Delete 2 items on the desktop
[6] Cradle device
[7] Synchronize - now ActiveSync first syncs device-to-desktop and
causes "DeleteObj" to be invoked on the desktop side for all 5 items
and then during a second automatic (i.e. ActiveSync launches another
sync immediately after the first one) sync moves the 3 items (even
though they haven't changed) from desktop to device and does nothing
about the 2 items that have been deleted.

If I understand it right, I must return TRUE from "ObjectNotify" on
the device side if and only if I intend to sync stuff back to the
desktop from the device. Is this right? I am not sure what's going
on here!

Please help! Thanks.

--
Ranju. V
http://blogorama.nerdworks.in/
--

Re: When is DeleteObj called on desktop side? by Carl

Carl
Sun Aug 12 22:23:38 CDT 2007

No, you will need to implement ObjectNotify(). What I think is happening is
that on the PC maintains state of all of the objects stored on your device.
When you cradle your device ObjectNotify() get's called for every object on
the device (if FindObjects() isn't implemented in your dll (I would
recommend you do this) ). I you don't return anything, than the PC says,
"hey someone delete these, since it's telling me that they are no longer
there", than it proceeds to delete them.



Also note, if sync is really simple like this, you needn't do all this work.
You could look at just use RAPI calls to copy files to the device.




--
Carl Wolz [MSFT]
This Posting is provided "AS IS" with no warranties, and confers no rights.



"Ranju. V" <avranju@gmail.com> wrote in message
news:1186941969.424058.5490@m37g2000prh.googlegroups.com...
> Hi,
>
> I have an ActiveSync service provider that needs to do only one way
> sync (so its essentially a transfer), i.e., it needs to move a bunch
> of files from the desktop to the device. The device side provider
> implementation therefore is pretty minimal except for the
> "IReplObjHandler" implementation. In fact, from "ObjectNotify" I just
> return FALSE.
>
> Now here's the issue - everytime I sync and uncradle the device all
> the items I have just synced fall off ActiveSync's radar so to speak,
> so that during the next sync ActiveSync does not really remember the
> stuff that was synced during the previous session. This happens only
> if I uncradle before I sync the second time. If I keep it connected
> then it works just fine.
>
> The reason why this happens appears to be that after cradling the
> device during the second sync, ActiveSync seems to do a device-to-
> desktop sync first, as a result of which "DeleteObj" gets called on
> the desktop side for every single item that was synced during the
> first sync. My implementation of "DeleteObj" on the desktop side does
> nothing other than return S_OK. Naturally, this results in all those
> items being removed from wherever it is that ActiveSync keeps that
> list (repl.dat?). Just to clarify, here's the scenario which causes
> the problem:
>
> [1] Cradle device
> [2] Synchronize - let's say 5 items get
> transferred to the device
> [4] Uncradle device
> [5] Delete 2 items on the desktop
> [6] Cradle device
> [7] Synchronize - now ActiveSync first syncs device-to-desktop and
> causes "DeleteObj" to be invoked on the desktop side for all 5 items
> and then during a second automatic (i.e. ActiveSync launches another
> sync immediately after the first one) sync moves the 3 items (even
> though they haven't changed) from desktop to device and does nothing
> about the 2 items that have been deleted.
>
> If I understand it right, I must return TRUE from "ObjectNotify" on
> the device side if and only if I intend to sync stuff back to the
> desktop from the device. Is this right? I am not sure what's going
> on here!
>
> Please help! Thanks.
>
> --
> Ranju. V
> http://blogorama.nerdworks.in/
> --
>



Re: When is DeleteObj called on desktop side? by Ranju

Ranju
Mon Aug 13 03:03:56 CDT 2007

On Aug 13, 8:23 am, "Carl Wolz [MSFT]" <ca...@online.microsoft.com>
wrote:
> No, you will need to implement ObjectNotify(). What I think is happening is
> that on the PC maintains state of all of the objects stored on your device.
> When you cradle your device ObjectNotify() get's called for every object on
> the device (if FindObjects() isn't implemented in your dll (I would
> recommend you do this) ). I you don't return anything, than the PC says,
> "hey someone delete these, since it's telling me that they are no longer
> there", than it proceeds to delete them.
>
> Also note, if sync is really simple like this, you needn't do all this work.
> You could look at just use RAPI calls to copy files to the device.

Thanks a ton for your suggestion regarding implementing "FindObjects"
as that has resolved the issue. The problem was that the ActiveSync
manager on the device had no way of knowing the status of the items it
synced during the previous sync. Since I had not implemented
"FindObjects", which it could have used to ascertain the status, it
just assumed that everything got deleted on the device! In my case,
since nothing ever changes on the device side, all I had to do was to
implement "FindObjects" and return the object IDs of all the items in
the store in the "unchanged" items list. That's it!

When the device stays connected between consecutive syncs however I
see that ActiveSync does not seem to feel the need to call
"FindObjects" to determine the status of the items on the device. I
guess, in case an item changes on the device while the connection is
hot, ActiveSync expects the application to proactively inform it of
that fact.

Thanks again! :)

--
Ranju. V
http://blogorama.nerdworks.in/
--


Re: When is DeleteObj called on desktop side? by Carl

Carl
Mon Aug 13 12:23:18 CDT 2007

You should get notifications for every object changed on the device. There
is also a timer which calls the ObjectNotify() every half second for SSP's
who track there own changes.


--
Carl Wolz [MSFT]
This Posting is provided "AS IS" with no warranties, and confers no rights.


"Ranju. V" <avranju@gmail.com> wrote in message
news:1186992236.474500.141380@l70g2000hse.googlegroups.com...
> On Aug 13, 8:23 am, "Carl Wolz [MSFT]" <ca...@online.microsoft.com>
> wrote:
>> No, you will need to implement ObjectNotify(). What I think is happening
>> is
>> that on the PC maintains state of all of the objects stored on your
>> device.
>> When you cradle your device ObjectNotify() get's called for every object
>> on
>> the device (if FindObjects() isn't implemented in your dll (I would
>> recommend you do this) ). I you don't return anything, than the PC says,
>> "hey someone delete these, since it's telling me that they are no longer
>> there", than it proceeds to delete them.
>>
>> Also note, if sync is really simple like this, you needn't do all this
>> work.
>> You could look at just use RAPI calls to copy files to the device.
>
> Thanks a ton for your suggestion regarding implementing "FindObjects"
> as that has resolved the issue. The problem was that the ActiveSync
> manager on the device had no way of knowing the status of the items it
> synced during the previous sync. Since I had not implemented
> "FindObjects", which it could have used to ascertain the status, it
> just assumed that everything got deleted on the device! In my case,
> since nothing ever changes on the device side, all I had to do was to
> implement "FindObjects" and return the object IDs of all the items in
> the store in the "unchanged" items list. That's it!
>
> When the device stays connected between consecutive syncs however I
> see that ActiveSync does not seem to feel the need to call
> "FindObjects" to determine the status of the items on the device. I
> guess, in case an item changes on the device while the connection is
> hot, ActiveSync expects the application to proactively inform it of
> that fact.
>
> Thanks again! :)
>
> --
> Ranju. V
> http://blogorama.nerdworks.in/
> --
>