|
I'm working on writing something that will allow you to create distribution groups in Exchange 2010.
The problem I am having is I am passing string arrays to my service for the Members and ManagedBy parameters.
This is how I attempted to make this work:
var members = new MultiValuedProperty<object>();
foreach (string s in group.Members)
members.Add(s);
cmd.AddParameter("Members", members);
The problem I'm having is it is returning an error because it appears it wants Microsoft.Exchange.Configuration.Tasks.RecipientWithAdUserGroupIdParameter within the MultiValuedProperty.
I'm a little confused because it then looks like the RecipientWithAdUserGroupIdParameter contains an array of RecipientIdParameter:
Error: System.ServiceModel.FaultException: System.Management.Automation.RemoteException: Cannot process argument transformation on parameter 'Members'. Cannot convert value "8caf8910-86d0-4d00-a452-8c30c0f62373 cfa01a55-6b35-4e61-bf0e-9050308623c7" to type "Microsoft.Exchange.Data.MultiValuedProperty`1[Microsoft.Exchange.Configuration.Tasks.RecipientWithAdUserGroupIdParameter`1[Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter]]". Error: "Cannot convert the "8caf8910-86d0-4d00-a452-8c30c0f62373" value of type "Deserialized.Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter" to type "Microsoft.Exchange.Configuration.Tasks.RecipientWithAdUserGroupIdParameter`1[Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter]"." at System.Management.Automation.PowerShell.CoreInvoke[TOutput](IEnumerable input, PSDataCollection`1 output, PSInvocationSettings settings) at System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings settings) at System.Management.Automation.PowerShell.Invoke() at CloudPanel.Exchange.ExchPs.RunPowershell(PSCommand pscmd, String script) at CloudPanel.Exchange.ExchPs.RunPowershell(PSCommand pscmd, String script) at CloudPanel.Exchange.ExchPs.New_DistributionGroup(DistributionGroup group, String companydn)
Anyone have an idea what I can do to accomplish this? There are some stuff out on the web about using ICollection when reading from Exchange but i'm trying to send commands to exchange.
|
|
|
|
|
RecipientIdParameter is the baseclass for RecipientWithAdUserGroupIdParameter so I think by passing the RecipientWithAdUserGroupIdParameter with the MultiValuedProperty might solve this error.
Note:I havent used this before.
Jibesh V P
|
|
|
|
|
The problem is RecipientWithAdUserGroupIdParameter is another array.
so it has to be done like this:
var members = new MultiValuedProperty<RecipientWithAdUserGroupIdParameter<RecipientIdParameter>>();
But then I can't add to the RecipientWithAdUserGroupIdParameter because it doesn't have that method.
new RecipientWithAdUserGroupIdParameter<RecipientIdParameter>().
Only has these methods:
Equals
GetHashCode
GetObjects<>
GetType
ToString
|
|
|
|
|
I need to do a simple drag and drop procedure, but I dont know why this code isn´t working...
MainWindow.XAML:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace WpfApplication13
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void img_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
Image img = (Image)sender;
DataObject dataObj = new DataObject(img);
DragDrop.DoDragDrop(img, dataObj, DragDropEffects.Move);
}
private void target_Drop(object sender, DragEventArgs e)
{
Image img = (Image)e.Data.GetData(typeof(Image));
Utes.Children.Remove(img);
Nivel1.Children.Add(img);
}
private void img_MouseMove(object sender, MouseEventArgs e)
{
}
private void img_DragLeave(object sender, DragEventArgs e)
{
e.Effects = DragDropEffects.Move;
}
Please... any advice will be appreciated!.
|
|
|
|
|
You need to give some info on symptoms of the issues, not just give a code dump saying 'this doesn't work, please fix it for me'.
My advice? Well debug it dear Liza, dear Liza...
|
|
|
|
|
try
{
try
{
}
catch
{
some exception caught here...
}
}
catch
{
how i skip above catch block and get exception in this block...
}
modified 23-Jan-13 13:08pm.
|
|
|
|
|
Have the first catch use throw.
|
|
|
|
|
if you would show in code that would be more helpful.
thanks
|
|
|
|
|
Which is why I won't -- please read some documentation.
|
|
|
|
|
try
{
try
{
throw new Exception();
}
catch(Exception exception)
{
throw;
}
}
catch(Exception exception2)
{
}
Note: You can also avoid catching the exception by putting a more specific type in the first catch (like IOException instead of Exception).
|
|
|
|
|
|
Hey folks!! Hope you can help me with my client code.
Först I debugg the Server wich is an consoleapplication and the server starts, secondly I debugg the Client, I put a nickname value to the nickNameTextBox and click on Connect (button2) the compiler stops at this code line
serverStream.Write(outStream, 0, outStream.Length);
It says that the objectreference has not given an instans of a object!!
Note!!!! The code is working fine with VS 2008 but Im currently trying to work with it on VS 2010 but it wont run like it should
This is the Client
using System.Windows.Forms;
using System.Net.Sockets;
using System.Threading;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
System.Net.Sockets.TcpClient clientSocket = new System.Net.Sockets.TcpClient();
NetworkStream serverStream = default(NetworkStream);
string readData = null;
public Form1()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
byte[] outStream = System.Text.Encoding.ASCII.GetBytes(nickNameTextBox.Text + "$");
serverStream.Write(outStream, 0, outStream.Length);
serverStream.Flush();
}
private void button1_Click(object sender, EventArgs e)
{
readData = "Conected to Chat Server ...";
msg();
clientSocket.Connect("127.0.0.1", 8888);
serverStream = clientSocket.GetStream();
byte[] outStream = System.Text.Encoding.ASCII.GetBytes(sendTextBox.Text + "$");
serverStream.Write(outStream, 0, outStream.Length);
serverStream.Flush();
Thread ctThread = new Thread(getMessage);
ctThread.Start();
}
private void getMessage()
{
while (true)
{
serverStream = clientSocket.GetStream();
int buffSize = 0;
byte[] inStream = new byte[10025];
buffSize = clientSocket.ReceiveBufferSize;
serverStream.Read(inStream, 0, buffSize);
string returndata = System.Text.Encoding.ASCII.GetString(inStream);
readData = "" + returndata;
msg();
}
}
private void msg()
{
if (this.InvokeRequired)
this.Invoke(new MethodInvoker(msg));
else
loggTextBox.Text = loggTextBox.Text + Environment.NewLine + " >> " + readData;
}
|
|
|
|
|
Why have you commented out the lines
from the button 2 handler - unless you have pressed Button1 first, the connection has not been established and it will likely throw an exception - probably the one you are complaining about.
Personally, I would have a "Connect" method, which checked if you are connected and does so if not - and call it from both click events. (I would probably also make it return the stream instead of using a class level variable directly in the two event handlers).
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
|
|
|
|
|
I put back the
clientSocket.Connect("127.0.0.1", 8888);
serverStream = clientSocket.GetStream(); and it worked it connects now but the problem is with the button1 which send the text to the server, it stops at this line
clientSocket.Connect("127.0.0.1", 8888);
|
|
|
|
|
That's why I suggested that you had a routine which checked if you were connected - you don't need (or want) to connect if you are connected already!
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
|
|
|
|
|
Hope Im not requestion to much but would you like to write that if-statemant?
|
|
|
|
|
I dunno - it's soooo difficult....
if (!clientSocket.Connected)
{
...
}
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
|
|
|
|
|
I changed it to
private void button1_Click(object sender, EventArgs e)
{
if (serverStream == null)
{
MessageBox.Show("Please connect to a server.");
return;
}
readData = "Conected to Chat Server ...";
msg();
clientSocket.Connect("127.0.0.1", 8888);
serverStream = clientSocket.GetStream();
byte[] outStream = System.Text.Encoding.ASCII.GetBytes(sendTextBox.Text + "$");
serverStream.Write(outStream, 0, outStream.Length);
serverStream.Flush();
Thread ctThread = new Thread(getMessage);
ctThread.Start();
}
But still the same
|
|
|
|
|
Well yes - what did you expect.
The logic I suggested is not what you did:
if (not connected)
connect
TalkToServer What you did was
if (not connected)
Complain
else
{
connect
TalkToServer
}
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
|
|
|
|
|
Thank you mate I appreciate your help, I changed it to this code,
the reason I commented out
because the compiler stops there when I debugg telling me that a socket is already connected, now the compiler runs withour errors but the server consoleAppplication doesn't receive any msg at all when I send it from sendTextBox..
private void button1_Click(object sender, EventArgs e)
{
if (serverStream == null)
{
MessageBox.Show("Please connect to a server.");
return;
}
else
{
readData = "Conected to Chat Server ...";
msg();
serverStream = clientSocket.GetStream();
byte[] outStream = System.Text.Encoding.ASCII.GetBytes(sendTextBox.Text + "$");
serverStream.Write(outStream, 0, outStream.Length);
serverStream.Flush();
Thread ctThread = new Thread(getMessage);
ctThread.Start();
}
}
The compiler stops on this code under the getMessage method
serverStream.Read(inStream, 0, buffSize);
|
|
|
|
|
Skytten wrote: The compiler stops on this code under the getMessage method
The compiler? What error message does it give?
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
|
|
|
|
|
"Failed to read data from the transport connection: An existing connection was forced to close by the remote host." It havens because I closed the Server... Anyway this project is driving me crazy man I can't see why it's not working and the Server doesn't get and show the string on the server prompt from the Client
|
|
|
|
|
I am going to write a C# 2010 application as a console application to start with. Eventually I will change the application to compile as a windows application so I do not get the dos pop windows. When this application goes into production, it will be executed by a windows scheduler. My question is the best way to pass parameters to this application.
Thus can you show me the following:
1. Code on how to accept values from parameters?
2. When the application runs as an executable, can you show me in code how to pass the values to this executable?
|
|
|
|
|
How to access command line parameters[^]. To execute a program with parameters you use a command line of the form:
program_name parameter1 parameter2 "a string parameter with spaces" parametr4 ...
|
|
|
|
|
There are several articles on here regarding parsing command line parameters. Here's one of the more recent ones:
Implementing command execution in a console application[^]
However, I caution you against expecting a Scheduled Task to be able to run a Windows application or anything that needs user interaction.
|
|
|
|