EzDevInfo.com

activesync interview questions

Top activesync frequently asked interview questions

Get ip address of host pc from windows mobile when connected via ActiveSync

I have a .Net Compact app running on Windows Mobile, and I want to be able to connect to a webservice running on the 'host' machine (i.e. the desktop the PDA is plugged into) when connected via ActiveSync, but I don't know the ip address of the host. How can I find the ip of the desktop PC progromatically on the PDA?


Source: (StackOverflow)

Exchange Web Service vs Exchange ActiveSync (or why buy the milk when you can get the cow for free?)

I have seen this question asked several times but the answers have so far been very robotic and disappointing:

What is the difference between EWS vs EAS?

Now, most sites give the following: "One is a protocol for mobile devices, the other is a web service." Well, no shit. Here's the real question:

What is stopping someone from setting up a descent library for EWS that any mobile app or OS could use instead of paying MS a per-user license fee for ActiveSync? Is EWS too expensive, since it's SOAPy instead of RESTful? Is ActiveSync doing more of the heavy lifting in terms of caching and general logic? Does EAS have some feature that EWS doesn't have (shared calendars or some such?) Is it really just a matter of mobile OSs wanting to ensure that Exchange 03 is supported?

I'm sure they each have their finer points that make them distinct, but the question that I think most people are getting at when this question gets asked is "Why should I pay for EAS if EWS can do the same thing and more if I'm willing to write the client side myself?"


Source: (StackOverflow)

Advertisements

Socket connect() always succeeds (TCP over ActiveSync)

I'm using TCP/IP over ActiveSync to connect from Windows CE device to Windows XP desktop. The WinSock connect() function always succeeds, no matter whether desktop server application is actually running.

The following simplified code demonstrates this issue:

#include "stdafx.h"
#include <Winsock2.h>

int _tmain(int argc, _TCHAR* argv[])
{
    const int Port = 5555;
    const char * HostName = "ppp_peer";  

    WSADATA wsadata;
    if (WSAStartup(MAKEWORD(1, 1), &wsadata) != 0)
        return 1;

    struct hostent * hp = gethostbyname(HostName);
    if (hp == NULL)
        return 1;

    struct sockaddr_in sockaddr;
    memset(&sockaddr, 0, sizeof(sockaddr));
    sockaddr.sin_family = AF_INET;
    sockaddr.sin_addr.s_addr = ((struct in_addr *)(hp->h_addr))->s_addr;
    sockaddr.sin_port = htons(Port);    

    int sock = socket(AF_INET, SOCK_STREAM, 0);
    if (sock == SOCKET_ERROR)
        return 1;

    int result = connect(sock, (struct sockaddr*)&sockaddr, sizeof(sockaddr));
    // result always 0 (success) here

    closesocket(sock);

    return 0;
} 

Is this a bug? If not, what is a correct way to determine that the server is actually online? Only to try to use the established connection (recv/send data)?

Device: Windows CE 5.0, WinSock 2.2; Desktop: Windows XP, SP3, ActiveSync 4.5.


Source: (StackOverflow)

How do I find ActiveSync attributes from Exchange with C#?

I'm trying to find some ActiveSync attributes from Exchange. I found a good article that shows a PowerShell cmdlet for finding this information. But I'm trying to find where this information is actually stored. I looked at my user objects in ADSI edit to see if any of the properties would be these values, but this does not seem to be the case. How do I find this information with C#?


Source: (StackOverflow)

WIN CE 5.0 ActiveSync Connect/Disconnect?

I'm having to back port some software from Windows Mobile 6.5 to Windows CE 5.0, the software currently detects when the unit is in the base unit (ActiveSync running).

I need to know when ActiveSync is running on the unit so that I can prepare the unit to send and receive files.

I've found an article on using PINVOKE methods such as CeRunAppAtEvent but I am clueless on how that would work.

    bool terminateDeviceEventThreads = false;
    IntPtr handleActiveSyncEndEvent;

    while (!terminateDeviceEventThreads)
        {
        handleActiveSyncEndEvent = NativeMethods.CreateEvent (IntPtr.Zero,
                                            true, false, "EventActiveSync");
        if (IntPtr.Zero != handleActiveSyncEndEvent)
            {
            if (NativeMethods.CeRunAppAtEvent ("\\\\.\\Notifications\\NamedEvents\\EventActiveSync",
                         (int) NOTIFICATION_EVENT.NOTIFICATION_EVENT_RS232_DETECTED))
                {
                NativeMethods.WaitForSingleObject (handleActiveSyncEndEvent, 0);

                //

                NativeMethods.ResetEvent (handleActiveSyncEndEvent);
                if (!NativeMethods.CeRunAppAtEvent ("\\\\.\\Notifications\\NamedEvents\\EventActiveSync",
                                 (int) NOTIFICATION_EVENT.NOTIFICATION_EVENT_NONE))
                    {
                    break;
                    }
                handleActiveSyncEndEvent = IntPtr.Zero;
                }
            }
        }

Source: (StackOverflow)

why do some ActiveSync commands work in Android Email application but not in standalone Java client?

I'm developing a Java Exchange ActiveSync client and I want to Sync the inbox folder to retrieve email headers. I followed the MS ActiveSync documentation and was able to authenticate, folderSync and sync with the server. However, only certain properties in the Sync command are working.

In order to test what good ActiveSync messages would look like, I used the Android Emulator plus CharlesProxy HTTP proxy to capture the ActiveSync messages sent from the Android Email application. I was able to catch and decode the WBXML messages successfully. I saw that ActiveSync XML messages that I had tried unsuccessfully to use worked fine from the 'built-in' email application. E.g.

This XML Sync command works when sent from the Email application, but not from my Java client:

<?xml version="1.0" encoding="utf-8" ?>
<Sync xmlns="AirSync">
    <Collections>
        <Collection>
            <Class>Email</Class>
            <SyncKey>sync key here</SyncKey>
            <CollectionId>collectionID HERE</CollectionId>
            <DeletesAsMoves/>
            <GetChanges/>
            <WindowSize>5</WindowSize>
            <Options>
                <FilterType>2</FilterType>
                <MIMESupport>2</MIMESupport>
                <MIMETruncation>7</MIMETruncation>
            </Options>
        </Collection>
    </Collections>
</Sync>

Does anyone know why? Do some applications somehow have special privileges that mean they can use the full ActiveSync protocol? I'd like to stress that I can run a successful Sync command like this:

<?xml version="1.0" encoding="utf-8" ?>
<Sync xmlns="AirSync">
    <Collections>
        <Collection>
            <Class>Email</Class>
            <SyncKey>sync key here</SyncKey>
            <CollectionId>collection Id here</CollectionId>
            <GetChanges/>
        </Collection>
    </Collections>
</Sync>

I just can't add the extra properties like the Android email app does.

Any help is appreciated!


Source: (StackOverflow)

How can I control my winmo phone?

I have been trying to find a way to control my winmo phone from my pc. (HTC S740)

What I want is to be able to call a number from an application, answer the phone from an application and hangup the phone from an application. It should also be able to track how long the ongoing call has been.

Any libraries out there that lets me make such an application with C#?

(The phone is connected to the pc via usb in Windows 7.)


Source: (StackOverflow)

Android tutorial / Ref : to access contacts, email and contacts using exchange activesync?

I planed to develop android app to sync outlook exchange contacts and mail to myapp. I googled it but not get any tutorial regarding that. I only gets the result to setup active sync and other third party apps. Any one please guide me to understand

  1. whats exchange active sync? Is there any library to access outlook exchange.
  2. Is there tutorial to write android/java program to access outlook exchange (exchange activesync).
  3. is there any open source project?

I may misunderstood the about exchange activesync.. please guide me to complete my project by referring good tutorials/blogs to completely understand this concepts..

Thank you,


Source: (StackOverflow)

ActiveSync client Java implementation

My company is working on a project to develop a desktop and mobile email client that can connect to different mail servers with minimal configuration for users or server admins. As we want to support Microsoft Exchange it seems we have to implement the ActiveSync protocol in Java. We're already aware of the licensing issues regarding use of ActiveSync and are in contact with Microsoft.

We've already noticed that Android provides a partial implementation of what we want to do but we're looking for a Java library that is more fully featured and easier to integrate into a non-android application.

The solution has to work as a Client, not a server implementation like DavMail. Basically a Java client implementation of Z-Push.

Anyone know of anything available?


Source: (StackOverflow)

.NETCF Async TCP socket graceful shutdown issue

I have a TCP client/server app to communicate with a Windows CE device over an ActiveSync connection. Both the client and server utilize Asynchronous sockets (i.e. the Socket.Begin* and Socket.End* functions). When both the client and server are running on my desktop everything functions exactly as expected, but when the client is running on the Windows CE device that's connected over ActiveSync, I always get a SocketException on the ReceiveCallback after calling Socket.Shutdown (when the device is initiating the disconnect). The full exception is:

System.Net.Sockets.SocketException: An error message cannot be displayed because an optional resource assembly containing it cannot be found
at System.Net.Sockets.Socket.ReceiveNoCheck()
at ReceiveAsyncRequest.doRequest()
at AsyncRequest.handleRequest()
at WorkerThread.doWork()
at WorkerThread.doWorkI()
at WorkItem.doWork()
at System.Threading.Timer.ring()

Everything also seems to work correctly if the server (running on the desktop) initiates the disconnect. I have a couple ideas on how to avoid this, including disallowing device initiated disconnects and ignoring all exceptions after initiating a disconnect. However, I'd like to know why this is happening and if there's a better way of handling it.

The Disconnect and ReceiveCallbacks (operationally identical on both the server and client) are:

public bool Disconnect(StateObject state)
{
  try{
    if(state.isDisconnecting) return false;

    state.isDisconnecting = true;
    state.sock.Shutdown(SocketShutdown.Both);
    //Wait for sending and receiving to complete, but don't wait more than 10 seconds
    for(int i=0; i<100 && (state.isSending || state.isReceiving); i++){
      System.Threading.Thread.Sleep(100);
    }

    /* Log the disconnect */

    state.sock.Close();

    return true;
  } catch (Exception e){
    /* Log the exception */

    return false;
  }
}

private void ReceiveCallback(IAsyncResult iar)
{
  StateObject state = (StateObject)iar.AsyncState;
  try{
    //handle the new bytes in the buffer.
    int recv = state.sock.EndReceive(iar);

    //Handle the buffer, storing it somewhere and verifying complete messages.

    if(recv > 0){
      //start listening for the next message
      state.sock.BeginReceive(state.recvBuffer, 0, StateObject.BUFFER_SIZE, SocketFlags.None, new AsyncCallback(ReceiveCallback), state);
    } else {
      state.isReceiving = false;
      Disconnect(state);
    }
  } catch (Exception e){
    /* Log the exception */
  }
}

//For reference, A StateObject looks kinda like this:
public class StateObject
{
  public const int BUFFER_SIZE = 1024;

  public Socket sock = null;
  public bool isSending = false;
  public bool isReceiving = false;
  public bool isDisconnecting = false;

  public byte[] recvBuffer = new byte[BUFFER_SIZE];
  public byte[] sendBuffer = new byte[BUFFER_SIZE];

  //Other stuff that helps handle the buffers and ensure complete messages,
  //  even when TCP breaks up packets.
}

Source: (StackOverflow)

Programming ActiveSync on Windows Mobile

I am developing a desktop app which manages contact information and I want to be able to have it sync with the contacts list on Windows Mobile devices. Which namespaces/APIs do I need to understand to do this? I would prefer something in .NET compact framework, but I can do Win32 as well. I am looking for an approach that is completely stand alone, i.e. not dependent on a separate app such as Outlook. Thanks


Source: (StackOverflow)

iOS NSURLAuthenticationMethodClientCertificate not requested vs ActiveSync server

I am trying to implement certificate authentication in an ActiveSync client I am developing. The code to use certificate auth might work, but as of now the server, or more accurately, the iOS library's interpretation of the server's response, seems incorrect to me. Here is my code:

- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
{
    NSURLProtectionSpace *protectionSpace = [challenge protectionSpace];
    NSString *authenticationMethod = [protectionSpace authenticationMethod];

    if ([authenticationMethod isEqualToString:NSURLAuthenticationMethodClientCertificate])
    {
        NSURLCredential* credential = [ self buildCredentialClientCert];

        if ( credential == nil )
        {
            [[challenge sender] cancelAuthenticationChallenge:challenge];
        }
        else
        {
            [[challenge sender] useCredential:credential forAuthenticationChallenge:challenge];
        }
    }
    else if ([authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust])
    {
        .... // do other stuff

The problem is, even though I know the server supports client certificate auth, when I set a breakpoint then authenticationMethod is always set to NSURLAuthenticationMethodServerTrust.

The raw HTTPS server response contains the following:

Error Code: 403 Forbidden. The page requires a client certificate as part of the authentication process. If you are using a smart card, you will need to insert your smart card to select an appropriate certificate. Otherwise, contact your server administrator. (12213)

My question is, what determines if the authentication challenge is NSURLAuthenticationMethodServerTrust versus NSURLAuthenticationMethodClientCertificate?


Source: (StackOverflow)

How to sync PC desktop mail client to an Exchange Activesync server?

I've got a situation where I want to connect to an email server whose only exposed service for mail/calendar is Activesync (it's an Exchange server). The only web interface exposed is "OWA light" which is horrific.

I'd like to figure out a way to synchronize the mail from this Exchange so that it appears in a desktop mail client (or a webmail client if there any that work this way - gmail doesn't support activesync for subscriptions -- it publishes its mail as activesync which is not what I want).

Basically the ascii art of what I want is:

Exchange => Activesync <=> Client application

There are lots of mobile client applications that do this, but I am looking for a desktop or webmail client that can handle activesync as a subscriber (kind of the way IMAP works).

Thanks for any references or ideas!

Steve


Source: (StackOverflow)

How to get Windows Mobile Device Center To Connect to the Emulator

I have recently installed Windows 7 and I have come to a conclusion. While Active Sync was old and did not work great, it did work. I could connect to my devices and emulators after the proper rituals and incantations.

The other conclusion I have come to is that Windows Mobile Device Center is worse that Active Sync was. I cannot get it to reliably connect to my emulator (yes, I have set the connection type to DMA) despite how many times I cradle and uncradle. (The emulator connects to the Visual Studio Debugger just fine though.)

With active sync I had to manually press the connect button in the connection settings after cradling the emulator. The biggest change I can see with Windows Mobile Device Center is that they removed that button.

Is there any way to get Active Sync to work on Windows 7 so I don't have to deal with this? Or is there some way to get it to connect to Windows Mobile Device more reliably?


Source: (StackOverflow)

Where is the ActiveSync / MS Exchange Source within the Android OS Code-Base

Ever since Froyo (Android 2.2), Google's Android OS has supported syncing Microsoft Exchange accounts using the ActiveSync protocol. I am trying to find Android's implementation of the ActiveSync protocol within the Android code-base.

Does anyone know where ActiveSync is implemented in Android? I have been rummaging around the GitHub repository but cannot find it.


Source: (StackOverflow)