in Search
 
Home Blogs Forums Marketplace Files
 
 
 

RFComAPI sample code for Delegation using C#

Last post 10-02-2007, 7:44 AM by bmorightfax. 2 replies.
Sort Posts: Previous Next
  •  09-25-2007, 1:33 PM 12983

    RFComAPI sample code for Delegation using C#

    Hi,

    Does anyone have a sample code to do delegation using RFCOMAPI? Thanks

  •  10-01-2007, 7:50 AM 12996 in reply to 12983

    Re: RFComAPI sample code for Delegation using C#

    Hi,

    The following snippet demonstrates how to display delegator's faxes. Please note that currently COM API requires that the delegatee have RightFax admin rights in order to retrieve delegator's faxes.
            //**** Delegate Test for getting another user's faxes ****
            //KMOREAU is a delegate of JTKIRK. So...
            //      JTKIRK (delegator)
            //         -KMOREAU (delegatee)
            private void GetDelegateFaxes()
            {
                if (OpenRFServer()) 
                {
                    //Prime a Dataset for faxes
                    DataSet ds = new DataSet();
                    ds.Tables.Add("FaxHist");
                    ds.Tables["FaxHist"].Columns.Add("FaxFileName");
                    ds.Tables["FaxHist"].Columns.Add("ToName");
                    ds.Tables["FaxHist"].Columns.Add("FromName");
                    ds.Tables["FaxHist"].Columns.Add("ToFaxNumber");
                    ds.Tables["FaxHist"].Columns.Add("TotalPages");
                    ds.Tables["FaxHist"].Columns.Add("IsReceived");
                    ds.Tables["FaxHist"].Columns.Add("FaxDisposition");
                    ds.Tables["FaxHist"].Columns.Add("FaxTerminationStatus");
                    ds.Tables["FaxHist"].Columns.Add("FaxPriority");

                    DataRow dr;
                    dgDelegateView.DataSource = null;

                    string fxDelegatee = cbRFUsers.Text; //KMOREAU
                    User _delegator = rfserver.get_User(txtLogin.Text); //JTKIRK

                    Delegates collDelegatees;
                    collDelegatees = _delegator.HasAccessToTheseUsers;

                    foreach (RFCOMAPILib.Delegate _delegate in collDelegatees)
                    {

                        if (_delegate.User.ID == fxDelegatee)
                        {
                            foreach (RFCOMAPILib.Fax _fax in _delegator.Faxes)
                            {
                                //Populate Datagrid with faxes
                                dr = ds.Tables["FaxHist"].NewRow();
                                dr["FaxFileName"] = _fax.FaxFilename;
                                dr["ToName"] = _fax.ToName;
                                dr["FromName"] = _fax.FromName;
                                dr["ToFaxNumber"] = _fax.ToFaxNumber;
                                dr["TotalPages"] = _fax.TotalPages;
                                dr["IsReceived"] = _fax.IsReceived;
                                dr["FaxDisposition"] = _fax.FaxDisposition;
                                dr["FaxTerminationStatus"] = _fax.FaxTerminationStatus;
                                dr["FaxPriority"] = _fax.Priority.ToString();
                                ds.Tables["FaxHist"].Rows.Add(dr);
                            }
                            dgDelegateView.DataSource = ds.Tables["FaxHist"];
                            dgDelegateView.Enabled = true;

                            //Get out of loop
                            break;
                        }
                    }
                    CloseRFServer();
                }
            }

    I hope this helps.

    Thanks.

    Arjuna

  •  10-02-2007, 7:44 AM 13004 in reply to 12996

    Re: RFComAPI sample code for Delegation using C#

    Thanks
View as RSS news feed in XML
  Privacy    Site Terms   Contact Administrator