Jump to content

Changing Stream Properties using .NET API

Perforce .NET API stream

  • Please log in to reply
3 replies to this topic

#1 vijai_ge



  • Members
  • Pip
  • 8 posts

Posted 04 October 2013 - 09:12 AM

I'm trying to change the Paths property of Stream through .NET API, not able to get any clue on how to do it. Even i tried using direct command which opens up a txt file to change the properties. Someone help me to do through either .NET API or command line. Thanks. Vijai.S

#2 P4Matt


    Advanced Member

  • Members
  • PipPipPip
  • 1383 posts

Posted 04 October 2013 - 05:27 PM

From the .NET API you'l want to use the GetStream() method on the Repository object to fetch the stream info:

GetStream(String, String, Options)

That will give you a stream object to manipulate that you should then be able to save with:


From the command line I would run 'p4 stream -o  //your/stream' to get a copy of the stream spec. Then you can modify it and send it back to Perforce by sending the file into 'p4 stream -i" via STDIN.

#3 vijai_ge



  • Members
  • Pip
  • 8 posts

Posted 07 October 2013 - 03:53 PM

Thank you very much. It works perfect. Now after updating the stream, i want to update the workspace with latest stream revision, i tried with

Perforce.P4.Client client = new Perforce.P4.Client();
client = rep.GetClient("myclient");

int max=1000;
Options sFlags = new Options(SyncFilesCmdFlags.Force, max);

FileSpec fs = new FileSpec();
LocalPath lp = new LocalPath(client.Root);
fs.LocalPath = lp;

client.SyncFiles(sFlags, fs);

the above line throwing "Object reference not set to an instance of an object". What is that i'm missing in this. Please guide me.


#4 p4bill


    Advanced Member

  • Members
  • PipPipPip
  • 217 posts

Posted 10 October 2013 - 04:46 PM

Looks like a null exception. As you step through the code, check to see that client does not come back null. If it did, that would explain the exception you are seeing with client.SyncFiles(sFlags, fs);

Also tagged with one or more of these keywords: Perforce .NET API, stream

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users