I have documentum developer edition 6.6. I want to get document content (read content into stream) using DFC in c#. I have used following C#.net code
IDfId id = collection.getId("r_object_id");
IDfDocument doc = (IDfDocument) session.getObject(id);
but it throws following exception.
Exception: Unable to cast COM object of type 'System.__ComObject' to
interface type 'DFCLib.IDfDocument'. This operation failed because the
QueryInterface call on the COM component for the interface with IID
'{EFAC2D68-175B-11D2-9927-006097C27C31}' failed due to the following
error: No such interface supported (Exception from HRESULT: 0x80004002
(E_NOINTERFACE)).
I also tried following method(it runs successfully) but i don't know how to read content into stream or memory stream.
IDfId id = collection.getId("r_object_id");
IDfSysObject sysObject = (IDfSysObject) session.getObject(id);
This will dump the file to a local filesystem path:
IDfId id = collection.getId("r_object_id");
IDfSysObject sysObject = (IDfSysObject) session.getObject(id);
sysObject.getFile(<path>)
Then you can open the file as a stream using standard .Net IO libraries, for example:
var stream = new System.IO.StreamReader(<path>)
I believe the DFC has some stream-based public methods (getContent?) but I have not seen them used successfully from .Net. However, I will suggest that you take a look at the DFS (Documentum Foundation Services) API instead of DFC. This is the supported API now and DFC is deprecated as a public API. DFS does have stream options when dealing with repository content.
You may also want to check http://developer.emc.com if this answer is not sufficient for your needs.
The exception says it cannot convert the COM Object to IDfDocument.
I would guess your target is not a document then.
It is weird for non-document sysobject to have a content, but it's still allowed.
The content could then be read with getFile as suggested in the other answer.
Related
StackTrace
" at Windows.Storage.AccessCache.StorageItemMostRecentlyUsedList.Add(IStorageItem file, String metadata, RecentStorageItemVisibility visibility)\r\n at FluentVideoPlayer.Helpers.FileHelper.<>c__DisplayClass7_0.b__0()\r\n at Microsoft.Toolkit.Uwp.Helpers.DispatcherHelper.<>c__DisplayClass10_0`1.b__0()"
I am trying to add a StorageFile to MostRecentlyUsedList and as a result I am getting this exception.
Exception
HRESULT E_FAIL has been returned from a call to a COM component
Code
internal async static Task AddToHistory(StorageFile fileToBeAdded) => await DispatcherHelper.ExecuteOnUIThreadAsync(() => StorageApplicationPermissions.MostRecentlyUsedList.Add(fileToBeAdded, "", RecentStorageItemVisibility.AppAndSystem));
I have this static method to use within a static class so I can call it from any page in the app. I can verify that StorageFile object is not null and perfect I also tried to solve it by using DispatcherHelper as you can see in the code, but with or without it, exception occurs in both cases.
Update
I have tried to add to FutureAccessList as well instead of MostRecentlyUsedList and I am getting same error in both cases
Update 2
accessing the list normally doesn't cause any error, like I can access it with following code
var mlist = StorageApplicationPermissions.MostRecentlyUsedList;
var entries = mlist.Entries;
error only occurs when I try to add a storagefile to it.
The problem was in partial StorageFiles I was actually querying the files from KnownFolders.VideoLibrary as per following blog post.
https://blogs.msdn.microsoft.com/adamdwilson/2017/12/20/fast-file-enumeration-with-partially-initialized-storagefiles/
so when we use following indexing option it actually initializes partial storage files for us which causes exception when we try to add it to most recently used list or futureacceslist
IndexerOption = IndexerOption.OnlyUseIndexerAndOptimizeForIndexedProperties
So to solve this I am now using IndexerOption.UseIndexerWhenAvailable now I don't get any exception, but ofcourse I am sacrificing the speed I was getting before with partial storage files. Which is disappointing as when trying to do a job with full storagefile, it should automatically initialize the partial storagefile to full storagefile as per the blog post. but that is not the case here unfortunately.
I am writing CD/DVD using IMAPI with C#.NET windows application.
The data I write on CD contains one executable file (test.exe) which is also developed with C#.NET and virtualized (sandobx) using Turbo Virtualization Studio.
All data to be written on CD is placed in one folder (source path) on C drive.
Following is small code snippet: -
IStream stream = null;
try
{
System.Diagnostics.Debug.Print("Adding - " + thisFileItem.SourcePath);
if (thisFileItem.SourcePath != null)
Win32.SHCreateStreamOnFile(thisFileItem.SourcePath, Win32.STGM_READ | Win32.STGM_SHARE_DENY_WRITE, ref stream);
if (stream != null)
{
fileSystemImage.Root.AddFile(thisFileItem.DestPath + thisFileItem.DisplayName, stream);
}
}
finally
{
if (stream != null)
{
Marshal.FinalReleaseComObject(stream);
}
}
Call to "fileSystemImage.Root.AddFile" method while adding test.exe throws COMException -1062555360 "Internal file system error occurred." All other files add and write properly.
Exception Details: -
COMException -1062555360
Internal file system error occurred.
at ImapiInterop.IFsiDirectoryItem.AddFile(String path, IStream fileData)
at ImapiImplementation.CDWriter.objBackgroundWorker_DoWork(Object sender, DoWorkEventArgs e) in C:\.........\CDWriter.cs:line 405
If I put my source folder on some other location (Desktop or D drive), all writing process (including test.exe) happens fine without error.
I suspect the issue is due to virutalization but not sure.
Please help.
The error message returned by IMAPI is incorrect and that is why all confusion.
Refer following link.
social.msdn.microsoft.com
Following is the text copied from answer (from Dmitri) on above site: -
IMAPI supports the ISupportErrorInfo interface, and we are aware of
the issue of mismatching error messages in your scenario.
Internally, IMAPI creates rollback objects to undo add/remove file
actions. We've had an issue where the rollback action was created
prematurely, so after the return code for IFsiDirectoryItem::AddFile
was already set, the rollback action was to remove the file from the
image. Since the file hasn't been added, IMAPI_E_FSI_INTERNAL_ERROR
exception was thrown, which changed the IErrorInfo message to the one
you're seeing.
We are aware of this issue, and it will be fixed in the next release
of IMAPI. Unfortunately, it is not serious enough to be addressed in a
hotfix.
I am using POS tagger for a project and it works successfully when it reads the tagger file from my computer (project's folder).
But I need to upload the tagger file first and read the tagger file from a URL.
To do so, I have uploaded the POS tagger file and I am trying to read the tagger file by giving the URL to the constructor of the MaxentTagger method: (my code is in C# and I have overridden the MaxentTagger class so it's constructor looks like this:
public Tagger ()
{
java.io.ByteArrayInputStream inputStream = new java.io.ByteArrayInputStream(System.IO.File.ReadAllBytes(#"C:\models\english-left3words-distsim.tagger"));
base.readModelAndInit(null, new java.io.DataInputStream(inputStream), false);
}
However I get this error when I run my code:
"An unhandled exception of type 'java.lang.RuntimeException' occurred in stanford-postagger.dll
Additional information: java.io.FileNotFoundException: Could not find a part of the path 'C:\u\nlp\data\pos_tags_are_useless\egw4-reut.512.clusters'."
Does anybody know why this happens and how I can resolve this? I appreciate any sort of help very much!
This error comes from the program trying to load a file which gives the distributional similarity mapping from words to clusters. It's trying to get it from the location that is specified in the training properties file (and you naturally don't have a file at that location). This happened because you don't have a properly initialized TaggerConfig object at the time readModelAndInit() is called. The way it gets initialized is unintuitive (was badly architected), but you're only encountering this because you're trying to use a non-public API.
Why can't you just use the public API as follows?
MaxentTagger base = new MaxentTagger("http://my.url.com/models/english-left3words-distsim.tagger");
Update: I downloaded Ramone project, added it to my project and then ran the application again with debugger. The error is shown below:
public MediaTypeWriterRegistration GetWriter(Type t, MediaType mediaType)
{
...
CodecEntry entry = SelectWriters(t, mediaType).FirstOrDefault(); => this line throws error
...
}
Error occurs in CodecManager.cs. I am trying to figure out why it does not recognize json-patch media type. Could it be because writer is not being registered correctly? I am looking into it. If you figure out the problem, please let me know. Since you are the author of the library, it will be easier for you to figure out the issue. I will have to go through all the code files and methods to find the issue. Thanks!
I was excited to know that Ramone library supports json-patch operations but when I tried it, I got following error:
415- Unsupported Media Type
This is the same error that I get when I use RestSharp. I thought may be RestSharp does not support json-patch and errors out so I decided to try Ramone lib but I still get same error. Endpoint has no issues because when I try same command using Postman, it works but when I try it programmatically in C#, it throws unsupported media type error. Here is my code:
var authenticator = new TokenProvider("gfdsfdsfdsafdsafsadfsdrj5o97jgvegh", "sadfdsafdsafdsfgfdhgfhehrerhgJ");
JsonPatchDocument patch = new JsonPatchDocument<MetaData>();
patch.Add("/Resident2", "Boyle");
//patch.Replace("/Resident", "Boyle");
RSession = RamoneConfiguration.NewSession(new Uri("https://api.box.com"));
RSession.DefaultRequestMediaType = MediaType.ApplicationJson;
RSession.DefaultResponseMediaType = MediaType.ApplicationJson;
Ramone.Request ramonerequest = RSession.Bind("/2.0/files/323433290812/metadata");
ramonerequest.Header("Authorization", "Bearer " + authenticator.GetAccessToken(code).AccessToken);
//var ramoneresponse = ramonerequest.Patch(patch); //results in error: 405 - Method Not Allowed
var ramoneresponse = ramonerequest.Put(patch); //results in error: 415 - Unsupported Media Type
var responsebody = ramoneresponse.Body
Endpoint information is available here: http://developers.box.com/metadata-api
I used json-patch section in the following article as a reference:
http://elfisk.dk/Ramone/Documentation/Ramone.pdf
By the way I tried Patch() method (as shown in above ref. article) but that resulted in "Method not allowed" so I used Put() method which seems to work but then errors out because of json-patch operation.
Any help, guidance, tips in resolving this problem will be highly appreciated. Thanks much in advance.
-Sham
The Box documentation says you should use PUT (which is quite a bit funny). The server even tells you that it doesn't support the HTTP PATCH method (405 Method Not Allowed) - so PUT it must be.
Now, you tell Ramone to use JSON all the time (RSession.DefaultRequestMediaType = MediaType.ApplicationJson), so you end up PUT'ing a JSON document to Box - where you should be PUT'ing a JSON-Patch document.
Drop the "RSession.DefaultRequestMediaType = MediaType.ApplicationJson" statement and send the patch document as JSON-Patch with the use of: ramonerequest.ContentType("application/json-patch+json").Put(...).
I'm attempting to build a graph using the directshow SDK. When I call GraphBuilder.AddSourceFilter, I get the error 0x800C000D
private IGraphBuilder graphBuilder = null;
private IBaseFilter sourceFilter = null;
int hr = 0;
graphBuilder = (IGraphBuilder)new FilterGraph();
hr = graphBuilder.AddSourceFilter(filename, #"Source1", out sourceFilter);
After which hr returns the error code mentioned above and an exception is thrown. Fearing I had an incorrect filename, I tried these:
udp://224.1.1.13:9005/10.10.1.3
udp://224.1.1.13:9005/0.0.0.0
udp://224.1.1.13:9005
The stream is available and transmitting and I have confirmed so with VLC using the address udp://224.1.1.13:9005
I am pretty inexperienced with DirectShow graph building, so I'm wondering if I'm missing something basic. I'v gone over the msdn documentation for graphbuilding, but I've heard that the process is a lot more nuanced than ms lets on.
0x800C000D is PST_E_UNKNOWN_EXCEPTION, and is a rare deprecated PStore failure code. The problem is that filter lookup/instantiation fails somewhere too deep. There is no stock DirectShow filter to handle udp:// streams (supposedly RTP/RTSP). VLC handles them using its own code.
You typically need specific third party filter to render these URLs, and this filter might also need to be added directly via AddFilter rather then relying on AddSourceFilter to pick it up through public protocol registrations.