cancel
Showing results for 
Search instead for 
Did you mean: 

Store_Type Field how to take from query?

shivtechno
Champ in-the-making
Champ in-the-making

/alfresco/service/api/node/FileName/{store_type}/{store_id}/{id}?a={attach?}

How do  write this store type field ..

3 REPLIES 3

afaust
Legendary Innovator
Legendary Innovator

The store_type, store_id and id fragments are all derived from the NodeRef of a document or folder. The NodeRef usually has the form of workspace://SpacesStore/some-uuid

In this form, workspace is the store_type, SpacesStore the store_id and some-uuid is the id. You should never assume the values are always going to be the same - the only thing that is guaranteed is the format using the separators :// and /. In effect, if you have a reference to a document / folder and you need to determine an URL, parse the NodeRef and plug in the fragments to an URL template like the one you asked about.

shivtechno
Champ in-the-making
Champ in-the-making

Thank you axel for your reply .. Smiley Happy

Actually i am doing integration alfresco CMIS with ASP.net MVC Application. i am trying to download file or document but  i am facing error to download the file, i had wrote below code

i was taken help to write this code from apache chemistry..

public ActionResult DownloadFile(string objectId, string DirName)

        {

           //string Portdetails= ServiceReference1.ACLServicePort;

            string UserName = Session["Username"].ToString();

            string Password = Session["Password"].ToString();

            string Message = "";

            bool IsSuccess = true;

            try

            {

                #region

                Dictionary<string, string> parameters = new Dictionary<string, string>();

                parameters[DotCMIS.SessionParameter.BindingType] = BindingType.AtomPub;

                parameters[DotCMIS.SessionParameter.AtomPubUrl] = "http://127.0.0.1:8080/alfresco/service/api/node/content/workspace/SpacesStore/'" + objectId + "'";

                parameters[DotCMIS.SessionParameter.User] = "admin";

                parameters[DotCMIS.SessionParameter.Password] = "sept";

                SessionFactory factory = SessionFactory.NewInstance();

                ISession session = factory.GetRepositories(parameters)[0].CreateSession();

                string FetchDocId = objectId;

                IObjectId id = session.CreateObjectId(FetchDocId);

                IDocument doc = session.GetObject(Session["value"].ToString()) as IDocument;

                // properties

                Console.WriteLine(doc.Paths);

                string url = "http://127.0.0.1:8080" + doc.Paths[0];

                WebClient webClient = new WebClient();

            

                Console.WriteLine(doc.GetPropertyValue("mySmiley Tongueroperty"));

                IProperty myProperty = doc["mySmiley Tongueroperty"];

                 // content

                IContentStream contentStream = doc.GetContentStream();

                Console.WriteLine("Filename:   " + contentStream.FileName);

                Console.WriteLine("MIME type:  " + contentStream.MimeType);

                Console.WriteLine("Has stream: " + (contentStream.Stream != null));

                HttpWebRequest fileReq = (HttpWebRequest)HttpWebRequest.Create(url);

                HttpWebResponse fileResp = (HttpWebResponse)fileReq.GetResponse();

                Stream stream = fileResp.GetResponseStream();

           

                ViewBag.Mesg = "File Download Start Please Check or CLick Below Link if takes longer time to download..";

                return View();

                #endregion

            }

            catch (Exception ex)

            {

                TempData["Message"] = "<strong> Sorry, an error has occurred</strong><br/><p>Unfortunately an error has occurred during the processing of your page request. We apologize for the inconvenience, Please refresh the page or try again later.</p><p>Error description: " + ex.Message + "</p>";

                IsSuccess = false;

                //return Json(new { Result = "OK", Message = Message });

                return View();

            }

        }

afaust
Legendary Innovator
Legendary Innovator

The URL you are using is not a proper CMIS URL. That would be the reason why it does not work. See this example for getting document contents (and the surrounding documentation) on what URLs to use.