This project is read-only.

Move Method

Aug 29, 2013 at 7:33 AM
Hi, I needed a move method so I added one. Posting here in case anyone needs it. Thanks for the SDK.
    /// <summary>
    /// Will move this subscriber to a new list.
    /// </summary>
    /// <returns></returns>
    public bool move(string destinationListURL) 
        bool success = false;

        // Build Post Data
        OAuth.Request request = api.BuildRequest();

        String url = self_link;

        // Build custom parameters for this OAuth Request
        SortedList<String, String> parameters = new SortedList<string, string>();
        parameters.Add("ws.op", "move");
        parameters.Add("list_link", destinationListURL);
        // Build request
        request.Build(parameters, url, "POST");

        WebClient client = new WebClient();

        client.Headers["Content-type"] = "application/x-www-form-urlencoded";

        String response = String.Empty;

            // Get response
            response = client.UploadString(self_link, request.Parameters);
            success = true;
        catch (WebException ex)
            // Throw Error Codes back to client
            // Client responsibility to handle them
            throw ex;

        return success;